List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver
public FirefoxDriver()
From source file:io.github.bonigarcia.wdm.test.FirefoxTest.java
License:Apache License
@Before public void setupTest() { driver = new FirefoxDriver(); }
From source file:io.github.siscultural.system_tests.AccessNonexistentPage.java
@Test public void accessNonexistentPage() { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/istoeoacrenomecxiste"); String text = driver.findElements(By.tagName("h1")).get(0).getText(); Assert.assertEquals("Whitelabel Error Page", text); driver.close();//from w w w . j a va 2s . c om }
From source file:io.github.siscultural.system_tests.CompleteLogin.java
@Test public void completeLogin() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); driver.findElement(By.name("email")).sendKeys("victor.hugo.origins@gmail.com"); driver.findElement(By.name("password")).sendKeys("abacaxi"); new WebDriverWait(driver, 500) { };// w w w . ja v a2 s . c o m driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; new WebDriverWait(driver, 500) { }; Assert.assertEquals("http://localhost:8080/home", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.CompleteLoginAndThemDoLogout.java
@Test public void completeLogin() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); driver.findElement(By.name("email")).sendKeys("victor.hugo.origins@gmail.com"); driver.findElement(By.name("password")).sendKeys("abacaxi"); new WebDriverWait(driver, 500) { };//w w w . ja va2s . co m driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; driver.get("http://localhost:8080/logout"); new WebDriverWait(driver, 500) { }; Assert.assertEquals("http://localhost:8080/", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.CompleteLoginAndTryBackAndDoLoginAgain.java
@Test public void CompleteLoginAndTryBackAndDoLoginAgain() { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); driver.findElement(By.name("email")).sendKeys("victor.hugo.origins@gmail.com"); driver.findElement(By.name("password")).sendKeys("abacaxi"); new WebDriverWait(driver, 500) { };/*from w ww . ja va 2 s . com*/ driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; new WebDriverWait(driver, 500) { }; driver.navigate().to("http://localhost:8080/"); Assert.assertEquals("http://localhost:8080/home", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.FailLoginWithEmailField.java
@Test public void failLoginWithEmailField() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); driver.findElement(By.name("email")).sendKeys("victor.hugo.origins@gmail.com"); new WebDriverWait(driver, 500) { };/* w w w. j av a 2 s.c o m*/ driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; new WebDriverWait(driver, 500) { }; Assert.assertEquals("http://localhost:8080/", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.FailLoginWithEmptyFields.java
@Test public void FailLoginWithEmptyFields() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); new WebDriverWait(driver, 500) { };// ww w . ja v a 2s . c o m driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; new WebDriverWait(driver, 500) { }; Assert.assertEquals("http://localhost:8080/", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.FailLoginWithPasswordlField.java
@Test public void failLoginWithPasswordlField() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/"); driver.findElement(By.name("password")).sendKeys("abacaxi"); new WebDriverWait(driver, 500) { };/* w w w .j a v a 2s .c om*/ driver.findElement(By.id("input-login")).click(); new WebDriverWait(driver, 500) { }; new WebDriverWait(driver, 500) { }; Assert.assertEquals("http://localhost:8080/", driver.getCurrentUrl()); driver.close(); }
From source file:io.github.siscultural.system_tests.ShowErrorPage.java
@Test public void showErrorPage() throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost:8080/istoeoacrenomecxiste"); String text = driver.findElements(By.tagName("h1")).get(0).getText(); new WebDriverWait(driver, 500) { };/*w w w . ja v a 2s .c om*/ Assert.assertEquals("Whitelabel Error Page", text); driver.close(); }
From source file:io.kahu.hawaii.cucumber.glue.html.HtmlSteps.java
License:Apache License
@Before("@web") public void beforeScenario() throws Exception { WebDriver driver;//from w w w .j av a 2 s . co m if (StringUtils.containsIgnoreCase(browser, "chrome")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new ChromeDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "opera")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.operaBlink(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new OperaDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "firefox")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new FirefoxDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "htmlunit")) { driver = new HtmlUnitDriver(BrowserVersion.CHROME); } else if (StringUtils.containsIgnoreCase(browser, "iexplore")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new InternetExplorerDriver(); } } else if (StringUtils.containsIgnoreCase(browser, "phantom")) { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, getOsSpecificPhantomDriverPath()); Proxy proxy = getHttpProxy(); if (proxy != null) { capabilities.setCapability(CapabilityType.PROXY, getHttpProxy()); } driver = new PhantomJSDriver(capabilities); } else if (StringUtils.containsIgnoreCase(browser, "safari")) { if (remote) { DesiredCapabilities capabilities = DesiredCapabilities.safari(); driver = createRemoteWebDriverForCapabilities(capabilities); } else { driver = new SafariDriver(); } } else { throw new IllegalStateException("Unsupported browser specified"); } webDriver = new EventFiringWebDriver(driver); webDriver.manage().deleteAllCookies(); turnOnImplicitWaits(); }