List of usage examples for org.openqa.selenium WebDriver getCurrentUrl
String getCurrentUrl();
From source file:org.suren.autotest.web.framework.invoker.EngineInvoker.java
License:Apache License
/** * urlwindow// w w w. j a va 2 s . co m * @param phoenix * @param params ? */ public static void closeWinByUrlStartWith(Phoenix phoenix, String[] params) { String startWith = params[0]; WebDriver driver = phoenix.getEngine().getDriver(); Set<String> handles = driver.getWindowHandles(); Iterator<String> handleIt = handles.iterator(); String currentHandle = driver.getWindowHandle(); while (handleIt.hasNext()) { String handle = handleIt.next(); driver.switchTo().window(handle); if (driver.getCurrentUrl().startsWith(startWith)) { driver.close(); break; } } driver.switchTo().window(currentHandle); }
From source file:org.surfnet.oaaas.selenium.ImplicitGrantTestIT.java
License:Apache License
private void performImplicitGrant(boolean needConsent) { WebDriver webdriver = getWebDriver(); String responseType = "token"; String clientId = "it-test-client-grant"; String redirectUri = "http://localhost:8080/fourOhFour"; String url = String.format("%s/oauth2/authorize?response_type=%s&client_id=%s&redirect_uri=%s", baseUrl(), responseType, clientId, redirectUri); webdriver.get(url);/*w w w . j a v a 2 s .c om*/ login(webdriver, needConsent); // Token response URI responseURI = URI.create(webdriver.getCurrentUrl()); assertThat(responseURI.getFragment(), containsString("access_token=")); assertThat(responseURI.getPath(), equalTo("/fourOhFour")); assertThat(responseURI.getHost(), equalTo("localhost")); }
From source file:org.uiautomation.ios.selenium.FormHandlingTest.java
License:Apache License
@Test public void testCanUseEnterKeyToSubmitForm() { driver.get(pages.formPage);//from w w w. ja v a 2s . c om WebElement element = driver.findElement(By.cssSelector("#nested_form input[type='text']")); final String curURL = driver.getCurrentUrl(); element.sendKeys("something" + Keys.ENTER); new WebDriverWait(driver, 3).until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver webDriver) { return !webDriver.getCurrentUrl().equals(curURL); } }); assertTrue(driver.getCurrentUrl().endsWith("something")); }
From source file:org.uiautomation.ios.selenium.FormHandlingTest.java
License:Apache License
@Test public void testCanUseReturnKeyToSubmitForm() { driver.get(pages.formPage);//w ww . jav a2 s. c om WebElement element = driver.findElement(By.cssSelector("#nested_form input[type='text']")); final String curURL = driver.getCurrentUrl(); element.sendKeys("something" + Keys.RETURN); new WebDriverWait(driver, 3).until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver webDriver) { return !webDriver.getCurrentUrl().equals(curURL); } }); assertTrue(driver.getCurrentUrl().endsWith("something")); }
From source file:org.wso2.am.integration.ui.pages.admin.LoginPage.java
License:Open Source License
public LoginPage(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. if (!(driver.getCurrentUrl().contains("login.jsp"))) { // Alternatively, we could navigate to the login page, perhaps logging out first throw new IllegalStateException("This is not the login page"); }// w w w. j a v a 2 s . com }
From source file:org.wso2.am.integration.ui.pages.apimanager.ApiManagerHomePage.java
License:Open Source License
public ApiManagerHomePage(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. if (!(driver.getCurrentUrl().contains("apimanager.jag"))) { throw new IllegalStateException("This is not the Api Manager Page"); }//from w ww . j a v a2 s. c om }
From source file:org.wso2.am.integration.ui.pages.apimanager.subscription.SubscriptionPage.java
License:Open Source License
public SubscriptionPage(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. if (!(driver.getCurrentUrl().contains("subscriptions.jag"))) { throw new IllegalStateException("This is not the Api Manager subscription"); }/*from w w w. j a v a2s . c om*/ }
From source file:org.wso2.am.integration.ui.pages.home.HomePage.java
License:Open Source License
public HomePage(boolean isTenant, WebDriver driver) throws IOException { this.isTenant = isTenant; if (this.isTenant) { if (!(driver.getCurrentUrl().contains("loginStatus=true"))) { throw new IllegalStateException("This is not the home page"); }//from w w w.jav a 2 s . c o m } }
From source file:org.wso2.am.integration.ui.pages.login.LoginPage.java
License:Open Source License
public LoginPage(WebDriver driver, boolean isCloudEnvironment) throws IOException { this.driver = driver; this.isCloudEnvironment = isCloudEnvironment; this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. if (this.isCloudEnvironment) { if (!(driver.getCurrentUrl().contains("home/index.html"))) { // Alternatively, we could navigate to the login page, perhaps logging out first throw new IllegalStateException("This is not the cloud login page"); }/* w w w. j a va2 s . c om*/ driver.findElement(By.xpath("//*[@id=\"content\"]/div[1]/div/a[2]/img")).click(); } else { if (!(driver.getCurrentUrl().contains("login.jsp"))) { // Alternatively, we could navigate to the login page, perhaps logging out first throw new IllegalStateException("This is not the product login page"); } } }
From source file:org.wso2.am.integration.ui.tests.pages.publisher.PublisherHomePage.java
License:Open Source License
public PublisherHomePage(WebDriver driver) throws IOException { super(driver); // Check that we're on the right page. if (!driver.getCurrentUrl().contains(APIMTestConstants.PUBLISHER_HOME_PAGE_URL_VERIFICATION)) { throw new IllegalStateException(driver.getCurrentUrl() + ": This is not the Publisher home page"); }// ww w .j a v a 2 s.c o m log.info("Page load : Publisher Home Page"); }