List of usage examples for org.openqa.selenium WebDriver get
void get(String url);
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) { };//ww w . j a v a2 s . co 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.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.j a va 2 s . c o m*/ Assert.assertEquals("Whitelabel Error Page", text); driver.close(); }
From source file:io.pivotal.cla.webdriver.pages.BasePage.java
License:Apache License
public static void get(WebDriver driver, String get) { String baseUrl = System.getProperty(WEBDRIVER_BASE_URL, "http://localhost"); driver.get(baseUrl + get); }
From source file:io.selendroid.demo.webui.EmployeeDirectoryTest.java
License:Apache License
@Step("Open Employee Directory in web view") public void openEmployeeDirectory() throws Exception { WebDriver driver = Driver.webDriver; driver.get("and-activity://io.selendroid.directory.EmployeeDirectory"); driver.switchTo().window("WEBVIEW"); }
From source file:io.selendroid.server.e2e.SessionCreationE2ETest.java
License:Apache License
private void testMethod(SelendroidCapabilities capa) throws Exception { WebDriver driver = new SelendroidDriver("http://localhost:5555/wd/hub", capa); String activityClass = "io.selendroid.testapp." + "HomeScreenActivity"; driver.get("and-activity://" + activityClass); driver.getCurrentUrl();//from w w w. j ava2 s .com try { driver.findElement(By.id("not there")); Assert.fail(); } catch (NoSuchElementException e) { // expected } WebElement inputField = driver.findElement(By.id("my_text_field")); Assert.assertEquals("true", inputField.getAttribute("enabled")); inputField.sendKeys("Selendroid"); Assert.assertEquals("Selendroid", inputField.getText()); driver.quit(); }
From source file:io.selendroid.server.e2e.SessionCreationE2ETests.java
License:Apache License
private void testMethod(SelendroidCapabilities capa) throws Exception { WebDriver driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), capa); String activityClass = "io.selendroid.testapp." + "HomeScreenActivity"; driver.get("and-activity://" + activityClass); driver.getCurrentUrl();/*from w w w. j a v a2 s.c o m*/ try { driver.findElement(By.id("not there")); Assert.fail(); } catch (NoSuchElementException e) { // expected } WebElement inputField = driver.findElement(By.id("my_text_field")); Assert.assertEquals("true", inputField.getAttribute("enabled")); inputField.sendKeys("Selendroid"); Assert.assertEquals("Selendroid", inputField.getText()); driver.findElement(By.id("buttonStartWebview")).click(); driver.switchTo().window("WEBVIEW"); WebElement element = driver.findElement(By.id("name_input")); element.clear(); ((JavascriptExecutor) driver).executeScript("var inputs = document.getElementsByTagName('input');" + "for(var i = 0; i < inputs.length; i++) { " + " inputs[i].value = 'helloJavascript';" + "}"); Assert.assertEquals("helloJavascript", element.getAttribute("value")); driver.quit(); }
From source file:io.tourniquet.selenium.SeleniumControl.java
License:Apache License
@Override protected void before() throws Throwable { this.managedContext = getSeleniumContext(); this.managedContext.ifPresent(SeleniumContext::init); SeleniumContext.currentContext().setBaseUrl(baseUrl); final WebDriver driver = SeleniumContext.currentDriver(); driver.get(baseUrl); driverInit.ifPresent(di -> di.accept(driver.manage())); this.startTime = Instant.now(); }
From source file:io.tourniquet.selenium.SeleniumControlExample.java
License:Apache License
@Test public void getPage() throws Exception { WebDriver driver = SeleniumContext.currentDriver(); driver.get(SeleniumContext.resolve("page1")); assertEquals("PAGE1", driver.getPageSource()); }
From source file:io.wcm.qa.galenium.testcase.AbstractGaleniumInteractiveBaseTestCase.java
License:Apache License
protected void loadUrl(String url) { WebDriver driver = getDriver(); getLogger().debug("loading URL: <a href=\"" + url + "\">" + url + "</a>"); driver.get(url); if (!isCurrentUrl(url)) { String currentUrl = getDriver().getCurrentUrl(); getLogger().debug("landed on URL: <a href=\"" + currentUrl + "\">" + currentUrl + "</a>"); } else {/*from w w w . ja v a 2 s .co m*/ getLogger().debug(GaleniumReportUtil.MARKER_PASS, "landed on URL: <a href=\"" + url + "\">" + url + "</a>"); } }
From source file:iTests.framework.utils.WebuiTestUtils.java
/** * use AbstractSeleniumTest static browser fields * @return/*from ww w . j av a 2 s . c o m*/ * @throws InterruptedException */ public LoginPage openAndSwitchToNewBrowser() throws InterruptedException { WebDriver drv = initializeWebDriver(); if (drv != null) { drv.get(baseUrl); Selenium selenium_temp = new WebDriverBackedSelenium(drv, baseUrl); seleniumBrowsers.add(selenium_temp); waitForServerConnection(drv); return getLoginPage(selenium_temp, drv); } else { Assert.fail("Failed to start a new browser"); } return null; }