Example usage for org.openqa.selenium WebDriver getCurrentUrl

List of usage examples for org.openqa.selenium WebDriver getCurrentUrl

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver getCurrentUrl.

Prototype

String getCurrentUrl();

Source Link

Document

Get a string representing the current URL that the browser is looking at.

Usage

From source file:org.wso2.greg.integration.common.ui.page.searchactivity.SearchActivityPage.java

License:Open Source License

public SearchActivityPage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    driver.findElement(By.linkText(uiElementMapper.getElement("search.activity.link"))).click();

    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("activities"))) {
        // Alternatively, we could navigate to the login page, perhaps logging out first
        throw new IllegalStateException("This is not the Search Activity page");
    }//from w w w .jav  a2 s. c o m
}

From source file:org.wso2.greg.integration.common.ui.page.searchhome.SearchHomePage.java

License:Open Source License

public SearchHomePage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    driver.findElement(By.linkText(uiElementMapper.getElement("search.page.link"))).click();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("search"))) {
        // Alternatively, we could navigate to the login page, perhaps logging out first
        throw new IllegalStateException("This is not the Search Activity page");
    }//from  w ww .  j a  v a  2 s  . c om
}

From source file:org.wso2.greg.integration.common.ui.page.store.StoreHomePage.java

License:Open Source License

public StoreHomePage(WebDriver driver) throws IOException {
    this.driver = driver;
    // Check that we're on the right page.
    if (!driver.getCurrentUrl().contains("")) {
        throw new IllegalStateException(driver.getCurrentUrl() + ":    This is not the store home page");
    }//from  w  ww  .j a va 2s  .c o m
    log.info("Page load : store Home Page");
}

From source file:org.wso2.greg.integration.common.ui.page.store.StoreLoginPage.java

License:Open Source License

public StoreLoginPage(WebDriver driver) {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains(""))) {
        throw new IllegalStateException("This is not the store login page");
    }//from w w w .  j a v  a2  s. c o  m
}

From source file:org.wso2.greg.integration.common.ui.page.uriList.UriListPage.java

License:Open Source License

public UriListPage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    driver.findElement(By.id(uiElementMapper.getElement("carbon.Main.tab"))).click();
    driver.findElement(By.linkText(uiElementMapper.getElement("uri.list.link"))).click();
    if (!(driver.getCurrentUrl().contains("generic"))) {
        // Alternatively, we could navigate to the login page, perhaps logging out first
        throw new IllegalStateException("This is not the URI List page");
    }/*from ww w .j  a  va  2  s  .c  om*/
}

From source file:org.wso2.identity.ui.integration.test.oidc.OIDCAuthCodeSessionTestCase.java

License:Open Source License

private void validateAuthenticationResponse(WebDriver driver) throws MalformedURLException {

    String query = new URL(driver.getCurrentUrl()).getQuery();

    if (StringUtils.isNotBlank(query)) {
        Map<String, String> queryParameters = getQueryParameters(query);
        Assert.assertNotNull(queryParameters.get("code"), "Authorization Code not received.");
        Assert.assertNotNull(queryParameters.get("session_state"), "Session State not reeived");
    } else {/*from  w w  w .j a  va2s. c o  m*/
        Assert.fail("Authorization Code and Session State not received");
    }
}

From source file:org.wso2.iot.integration.ui.pages.login.MDMLoginPage.java

License:Open Source License

public MDMLoginPage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("mdm/login"))) {
        // Alternatively, we could navigate to the login page, perhaps logging out first
        throw new IllegalStateException("This is not the login page");
    }/*from   www . j a  va  2 s.co  m*/
}

From source file:org.wso2.iot.integration.ui.pages.Notification.NotificationView.java

License:Open Source License

public NotificationView(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("notification-listing"))) {
        throw new IllegalStateException("This is not the notification-listing page");
    }//  w  w w .  j av a2s  . c  om
}

From source file:org.wso2.iot.integration.ui.pages.role.AddRolePage.java

License:Open Source License

public AddRolePage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("roles/add-role"))) {
        throw new IllegalStateException("This is not the add role page");
    }/*from   www.j  ava 2 s. com*/
}

From source file:org.wso2.iot.integration.ui.pages.role.EditRolePage.java

License:Open Source License

public EditRolePage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("roles/edit-role"))) {
        throw new IllegalStateException("This is not the edit role page");
    }/*from   w ww.  j  a  v a2s .com*/
}