Example usage for org.openqa.selenium WebDriver findElement

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

Introduction

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

Prototype

@Override
WebElement findElement(By by);

Source Link

Document

Find the first WebElement using the given method.

Usage

From source file:AM.Physician.AddNewPhysician.java

public static Select lst_AP_InternalLiaison(WebDriver driver) {
    element = driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[4]/ul/li/select"));
    list = new Select(driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[4]/ul/li/select")));
    Waits.ForElementVisibility(driver, element);
    return list;//from ww  w .jav a  2  s  . c  o m
}

From source file:AM.Physician.AddNewPhysician.java

public static WebElement txt_AP_Comments(WebDriver driver) {
    element = driver.findElement(By.xpath("//*[@id='PhysicianForm']/div[2]/div[6]/ul/textarea"));
    Waits.ForElementVisibility(driver, element);
    return element;
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void selectApplication(WebDriver driver1, WebDriverWait wait, applications app)
        throws IOException {
    if (!isApplicationAlreadySelected(driver1, app)) {
        logger.info("Selecting application " + app);
        wait.until(ExpectedConditions/*from w  w  w.ja va  2  s. c  o  m*/
                .visibilityOfElementLocated(By.id(applangoButtons.APPLICATION_DROP_DOWN.getValue())));
        driver1.findElement(By.id(applangoButtons.APPLICATION_DROP_DOWN.getValue())).click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(app.getValue())));
        driver1.findElement(By.id(app.getValue())).click();
        waitUntilWaitForServerDissappears(wait);
    }
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static boolean isApplicationAlreadySelected(WebDriver driver1, applications app) {
    return app.getValue().toLowerCase()
            .contains(driver1.findElement(By.id("appTitle")).getText().toLowerCase());
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void enterCredentials(WebDriver driver, String username, String password) throws IOException {

    logger.info("Entering credentials and pressing on login (username= " + username + ", password= " + password
            + ")");
    driver.findElement(By.id(applangoTextfields.MAIN_LoginUsername.getValue().toString())).clear();
    driver.findElement(By.id(applangoTextfields.MAIN_LoginUsername.getValue().toString())).sendKeys(username);
    driver.findElement(By.id(applangoTextfields.MAIN_LoginPassword.getValue().toString())).clear();
    driver.findElement(By.id(applangoTextfields.MAIN_LoginPassword.getValue())).sendKeys(password);
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void clickOnLogin(WebDriver driver) throws IOException {
    SeleniumTestBase.logger.info("Clicking on login button (by id)");
    driver.findElement(By.id(applangoButtons.LOGIN_SUBMIT.getValue())).click();

    System.currentTimeMillis();//ww w.j  a  va 2 s .  com
    driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);

}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static void waitForCredentialsErrorMessage(WebDriver driver, WebDriverWait wait, String errorMessage)
        throws IOException {
    wait.until(ExpectedConditions.visibilityOfElementLocated(
            By.id(applangoObject.INCORRECT_CREDENTIALS_ERRORMESSAGE.getValue().toString())));
    Assert.assertTrue(/*w  ww.  j a v  a2  s. c o m*/
            driver.findElement(By.id(applangoObject.INCORRECT_CREDENTIALS_ERRORMESSAGE.getValue().toString()))
                    .getText().equals(errorMessage));
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void clickOnSubmitCredentials(WebDriver driver) throws IOException {
    Map appObjectMapper = objectMapper.getObjectMap(jsonMaps.APPLANGO);
    String loginSubmit = appObjectMapper.get(LOGIN_SUBMIT_UI_OBJECT).toString();
    driver.findElement(By.xpath(loginSubmit)).click();
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void filterByDate(WebDriver driver1, WebDriverWait wait, String fromYear, months fromMonth,
        String untilYear, months toMonth) throws IOException {
    logger.info("Filter dates " + fromMonth + "/" + fromYear + " - " + toMonth + "/" + untilYear);
    driver1.findElement(By.id(applangoDropdowns.FROM_YEAR.getValue().toString())).sendKeys(fromYear);
    driver1.findElement(By.id(applangoDropdowns.FROM_MONTH.getValue().toString()))
            .sendKeys(fromMonth.getValue().toString());
    driver1.findElement(By.id(applangoDropdowns.UNTIL_YEAR.getValue().toString())).sendKeys(untilYear);
    driver1.findElement(By.id(applangoDropdowns.UNTIL_MONTH.getValue().toString()))
            .sendKeys(toMonth.getValue().toString());
    clickOnDateSearchButton(driver1, wait);
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void clickOnDateSearchButton(WebDriver driver1, WebDriverWait wait) throws IOException {
    logger.info("Clicking on Date Search button");
    driver1.findElement(By.id(applangoButtons.DATE_SEARCH.getValue().toString())).click();
    waitForUserListToLoad(wait);/*from w w  w  . jav  a2  s.  com*/
}