Example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver.

Prototype

public FirefoxDriver() 

Source Link

Usage

From source file:CakeHomePageTest.java

@Before
public void openBrowser() {
    baseUrl = "http://getcake.com/";
    driver = new FirefoxDriver();
    driver.get(baseUrl);//from   www. j a va  2s . co  m
    try {
        Thread.sleep(4000);
    } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
    }
}

From source file:ExpiredLicenseSelenium.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:FirefoxDriverDemo.java

public static void main(String[] args) {
    String baseURL = "http://www.google.com";
    WebDriver driver = new FirefoxDriver();
    System.setProperty("webdriver.gecko.driver", "/Users/srijana/Documents/seleniumpractise notes/geckodriver");

    driver.get(baseURL);//from w  ww  .ja  va2  s . c om
}

From source file:TestWriteanArticle.java

@org.junit.Test
public void positive() throws InterruptedException {
    System.setProperty("webdriver.gecko.driver", "C://Users/Mari/Downloads/geckodriver.exe");
    WebDriver webDriver = new FirefoxDriver();
    String page = "http://www.wikihow.com/Special:CreatePage";
    webDriver.get(page);//from   w  ww .  ja va  2s  .c  o  m
    WebElement title = webDriver.findElement(By.id("cp_title_input"));
    title.sendKeys("how to use selenium");
    webDriver.findElement(By.id("cp_title_btn")).click();
    Thread.sleep(10);

    WebDriverWait wait = new WebDriverWait(webDriver, 50);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("cpr_title_hdr")));
    assertTrue(webDriver.getPageSource().contains("Are any of these topics the same as yours?"));

    webDriver.close();
}

From source file:TestWriteanArticle.java

@org.junit.Test
public void negative() throws InterruptedException {
    System.setProperty("webdriver.gecko.driver", "C://Users/Mari/Downloads/geckodriver.exe");
    WebDriver webDriver = new FirefoxDriver();
    String page = "http://www.wikihow.com/Special:CreatePage";
    webDriver.get(page);/*from   w ww  . j  a  v  a2  s.co  m*/
    WebElement title = webDriver.findElement(By.id("cp_title_input"));
    title.sendKeys("how to use wikiHow");
    webDriver.findElement(By.id("cp_title_btn")).click();
    Thread.sleep(10);

    WebDriverWait wait = new WebDriverWait(webDriver, 50);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("cpr_title_hdr")));
    assertTrue(webDriver.getPageSource().contains("That article already exists!"));

    webDriver.close();
}

From source file:FindByLinkText.java

public static void main(String[] args) throws Exception {
    String baseURL = "http://demostore.x-cart.com/";
    System.setProperty("webdriver.gecko.driver",
            "/Users/srijana/Documents/seleniumpractise notes/geckodriver 2");
    WebDriver driver = new FirefoxDriver();

    driver.get(baseURL);// w w  w  .j a va2s  .c o m

    //driver.findElement(By.xpath(".//*[@id='header-area']/div[1]/div/div[4]/div/ul/li[4]/a/span")).click();

    //driver.findElement(By.xpath(".//*[@id='header-area']/div[1]/div/div[4]/div/ul/li[7]/a/span")).click();

    driver.findElement(By.tagName("a")).click();

}

From source file:NewSeleneseIT.java

@Test
public void testSimple() throws Exception {
    // Create a new instance of the Firefox driver
    // Notice that the remainder of the code relies on the interface, 
    // not the implementation.
    System.setProperty("webdriver.gecko.driver", "/home/klaudia/geckodriver");
    WebDriver driver = new FirefoxDriver();

    // And now use this to visit NetBeans
    driver.get("http://www.netbeans.org");
    // Alternatively the same thing can be done like this
    // driver.navigate().to("http://www.netbeans.org");

    // Check the title of the page
    // Wait for the page to load, timeout after 10 seconds
    (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
        @Override//  www  .j a  v  a 2 s . c o m
        public Boolean apply(WebDriver d) {
            return d.getTitle().contains("NetBeans");
        }
    });

    //Close the browser
    driver.quit();
}

From source file:IdXPATHDemo.java

public static void main(String[] args) {
    String baseURL = "http://www.google.com";
    System.setProperty("webdriver.gecko.driver",
            "/Users/srijana/Documents/seleniumpractise notes/geckodriver 2");
    WebDriver driver = new FirefoxDriver();

    driver.get(baseURL);/*from  w ww  .  j ava2  s.c o  m*/

    driver.findElement(By.id("lst-ib")).sendKeys("letskodeit");
    driver.findElement(By.xpath("//*[@id='sblsbb']/button")).click();
}

From source file:OpennmsSeleniumExample.java

License:Open Source License

@Before
public void setUp() throws Exception {
    System.err.println("Before is being called in Groovy Script: " + this.hashCode());
    driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(timeout, TimeUnit.SECONDS);
}

From source file:IdNameDemo.java

public static void main(String[] args) {
    String baseURL = "http://www.google.com";
    System.setProperty("webdriver.gecko.driver",
            "/Users/srijana/Documents/seleniumpractise notes/geckodriver 2");
    WebDriver driver = new FirefoxDriver();

    driver.get(baseURL);/*from ww  w  .  j a  v  a2 s .co  m*/

    driver.findElement(By.id("lst-ib")).sendKeys("letskodeit");
    driver.findElement(By.name("btnG")).click();
}