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:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static int searchOnWhichRowInTableTheUserAppear(WebDriver driver1, String name) throws IOException {
    //Return the number of row in user table, by cutting user until finding the user on index 0
    int lineCounter = 1;
    int lineBreak = driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText()
            .indexOf("\n");
    int indexOfName = driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText()
            .indexOf(name);/*from  w  w w.j  av  a2  s  .c  o m*/
    String listOfUsers = driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText();
    while (indexOfName != 0) {
        listOfUsers = listOfUsers.substring(lineBreak + 1, listOfUsers.length());
        lineCounter++;
        lineBreak = listOfUsers.indexOf("\n");
        indexOfName = listOfUsers.indexOf(name);
    }
    return lineCounter;
}

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

public static void enterValueInSearchLastName(WebDriver driver1, String lastName) throws IOException {
    driver1.findElement(By.id(applangoTextfields.SearchLastName.getValue().toString())).clear();
    driver1.findElement(By.id(applangoTextfields.SearchLastName.getValue().toString())).sendKeys(lastName);
}

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

public static boolean checkIfUserExistInList(WebDriver driver, String name) throws IOException {
    return driver.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText().contains(name);

}

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

private static void clickOnAccount(WebDriver driver1) throws IOException {
    driver1.findElement(By.xpath(applangoButtons.ACCOUNT.getValue().toString())).click();
}

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

private static void clickOnLogout(WebDriver driver1) throws IOException {
    driver1.findElement(By.xpath(applangoButtons.LOGOUT.getValue().toString())).click();
}

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

private static void openUserMenu(WebDriver driver1) throws IOException {
    driver1.findElement(By.xpath(applangoDropdowns.USER_MENU.getValue().toString())).click();
}

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

public static void clickOnChangePassword(WebDriver driver1, WebDriverWait wait) throws IOException {
    driver1.findElement(By.id(applangoButtons.CHANGE_PASSWORD.getValue().toString())).click();
    waitForForgotPasswordDialog(wait);/* w  w w.j av a 2s.  c  om*/

}

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

public static void fillChangePasswordAndSubmit(WebDriver driver1, String currentPassword, String newPassword,
        String confirmNewPassword, boolean isResetPassword) throws IOException {
    driver1.findElement(By.id(applangoTextfields.NEW_PASSWORD.getValue().toString())).clear();
    driver1.findElement(By.id(applangoTextfields.NEW_PASSWORD.getValue().toString())).sendKeys(newPassword);
    if (!isResetPassword) {
        driver1.findElement(By.id(applangoTextfields.CURRENT_PASSWORD.getValue().toString())).clear();
        driver1.findElement(By.id(applangoTextfields.CURRENT_PASSWORD.getValue().toString()))
                .sendKeys(currentPassword);
        driver1.findElement(By.id(applangoTextfields.CONFIRM_PASSWORD.getValue().toString())).clear();
        driver1.findElement(By.id(applangoTextfields.CONFIRM_PASSWORD.getValue().toString()))
                .sendKeys(confirmNewPassword);

    } else {//  w w  w  .  java 2 s  .co  m
        driver1.findElement(By.id(applangoTextfields.CONFIRM_PASSWORD_RESET.getValue().toString())).clear();
        driver1.findElement(By.id(applangoTextfields.CONFIRM_PASSWORD_RESET.getValue().toString()))
                .sendKeys(confirmNewPassword);
        driver1.findElement(By.id(applangoButtons.LOGIN_SUBMIT.getValue().toString())).click();

    }

    if (!isResetPassword) {
        clickOnSubmitChangePassword(driver1);

    }
}

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

private static void clickOnSubmitChangePassword(WebDriver driver1) throws IOException {
    driver1.findElement(By.id(applangoButtons.CHANGE_PASSWORD_SUBMIT.getValue().toString())).click();
}

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

public static String getName(WebDriver driver1) throws IOException {
    //        int appRank =  0;
    return driver1.findElement(By.cssSelector(applangoObject.USERTABLER.getValue()))
            .findElements(By.cssSelector("td")).get(0).getText();

    //        return appRank;
}