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.carbon.am.integration.ui.pages.store.TestAPIPage.java

License:Open Source License

public TestAPIPage(WebDriver driver) throws IOException {
    super(driver);

    if (!(driver.getCurrentUrl().contains(APIMTestConstants.STORE_REST_CLIENT_URL_VERIFICATION))) {
        throw new IllegalStateException("This is not the RESTClient page");
    }//from  w  w  w .  j a  va2 s .  c o m
    log.info("RESTClient loaded"
            + driver.findElement(By.className("title-section")).findElement(By.tagName("h2")));
}

From source file:org.wso2.carbon.appmanager.integration.ui.Util.APPMPublisherUIClient.java

License:Open Source License

/**
 * Logout from the APP_M store// w w  w.jav  a2 s .c om
 *
 * @param driver     selenium WebDriver.
 * @param backEndUrl store host
 */
public String logout(WebDriver driver, String backEndUrl) {

    driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

    WebDriverWait wait = new WebDriverWait(driver, 30);
    driver.get(backEndUrl + uiElementMapper.getElement("pubisher_url"));
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(uiElementMapper.getElement("store_dropdown_xpath_locator"))));
    driver.findElement(By.xpath(uiElementMapper.getElement("store_dropdown_xpath_locator"))).click();
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(uiElementMapper.getElement("store_sign_out_xpath_locator"))));
    driver.findElement(By.xpath(uiElementMapper.getElement("store_sign_out_xpath_locator"))).click();

    return driver.getCurrentUrl();

}

From source file:org.wso2.carbon.appmanager.integration.ui.Util.APPMStoreUIClient.java

License:Open Source License

/**
 * Logout from the APP_M store//from  w w  w .  j a v a2s .c  om
 *
 * @param driver     selenium WebDriver.
 * @param backEndUrl store host
 */
public String logout(WebDriver driver, String backEndUrl) {

    driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

    WebDriverWait wait = new WebDriverWait(driver, 30);
    driver.get(backEndUrl + uiElementMapper.getElement("store_url"));
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(uiElementMapper.getElement("store_dropdown_xpath_locator"))));
    driver.findElement(By.xpath(uiElementMapper.getElement("store_dropdown_xpath_locator"))).click();
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(uiElementMapper.getElement("store_sign_out_xpath_locator"))));
    driver.findElement(By.xpath(uiElementMapper.getElement("store_sign_out_xpath_locator"))).click();

    return driver.getCurrentUrl();

}

From source file:org.wso2.carbon.greg.store.SearchResultsPage.java

License:Open Source License

/**
 * Constructor for search results page. This performs search of any given query on store and constructs
 * the results page. This verifies if the driver is in results page before returns.
 *
 * @param driver   WebDriver object to perform operations.
 * @param query    The search query.//from w ww.ja v a2  s. c  o  m
 * @param hitEnter True, if the search needs to be done by hitting the enter button on search field.
 */
public SearchResultsPage(WebDriver driver, String query, boolean hitEnter) {

    this.driver = driver;
    uiElementMapper = UIElementMapper.getInstance();
    String searchbarMapperId = "store.searchbar.id";

    this.driver.findElement(By.id(uiElementMapper.getElement(searchbarMapperId))).click();
    this.driver.findElement(By.id(uiElementMapper.getElement(searchbarMapperId))).clear();
    if (hitEnter) {
        this.driver.findElement(By.id(uiElementMapper.getElement(searchbarMapperId))).sendKeys(query,
                Keys.ENTER);
    } else {
        this.driver.findElement(By.id(uiElementMapper.getElement(searchbarMapperId))).sendKeys(query);
        this.driver.findElement(By.id(uiElementMapper.getElement(searchbarMapperId))).click();
    }
    assertTrue(driver.getCurrentUrl().contains("q="));
}

From source file:org.wso2.emm.integration.ui.pages.certificateConfiguration.AddCertificatePage.java

License:Open Source License

public AddCertificatePage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    if (!(driver.getCurrentUrl().contains("certificates/add"))) {
        throw new IllegalStateException("This is not the add certificate page");
    }/*  ww w. j  av  a2  s.c o  m*/
}

From source file:org.wso2.emm.integration.ui.pages.login.ManagementConsoleLoginPage.java

License:Open Source License

public ManagementConsoleLoginPage(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. ja v  a  2  s.  c  om*/
}

From source file:org.wso2.emm.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("emm/login"))) {
        // Alternatively, we could navigate to the login page, perhaps logging out first
        throw new IllegalStateException("This is not the login page");
    }/*www  .j ava  2s  . c  o m*/
}

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

License:Open Source License

/**
 * Constructor for the NotificationView Class
 * @param driver Instance of the current Web driver
 * @throws IOException driver throws an IOException if failed to load the input URL.
 *///from   www . j  av  a  2  s  . com
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");
    }
}

From source file:org.wso2.emm.integration.ui.pages.platformConfiguration.PlatformConfiguration.java

License:Open Source License

public PlatformConfiguration(WebDriver driver) throws IOException {
    this.driver = driver;
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("platform-configuration"))) {
        throw new IllegalStateException("This is not the platform-configuration page");
    }//from   w  w  w  .  j ava  2s. co m
}

From source file:org.wso2.emm.integration.ui.pages.policy.AddPolicyPage.java

License:Open Source License

public AddPolicyPage(WebDriver driver) throws IOException {
    this.driver = driver;
    this.actions = new Actions(driver);
    this.uiElementMapper = UIElementMapper.getInstance();
    // Check that we're on the right page.
    if (!(driver.getCurrentUrl().contains("policy/add"))) {
        throw new IllegalStateException("This is not the add policy page");
    }/*  w  w  w .j a v  a 2 s .  c  o m*/
}