Example usage for org.openqa.selenium By id

List of usage examples for org.openqa.selenium By id

Introduction

In this page you can find the example usage for org.openqa.selenium By id.

Prototype

public static By id(String id) 

Source Link

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);//  w  w  w.  j  ava 2  s.  co 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 waitForUserAccountPage(WebDriverWait wait) throws IOException {
    wait.until(ExpectedConditions/*  w ww . j  av a  2s.c om*/
            .visibilityOfElementLocated(By.id(applangoObject.ACCOUNT_TITLE.getValue().toString())));
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.id(applangoButtons.CHANGE_PASSWORD.getValue().toString())));
}

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);//from ww  w.java 2s . c om

}

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

private static void waitForForgotPasswordDialog(WebDriverWait wait) throws IOException {
    wait.until(ExpectedConditions/*from  w  w w. ja va 2  s  .  com*/
            .visibilityOfElementLocated(By.id(applangoButtons.CHANGE_PASSWORD_SUBMIT.getValue().toString())));
}

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 {//from  w w  w .  j  a v  a  2 s  .  c  o 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 void checkChangePasswordMessage(SearchContext driver1, applangoMessages changePasswordMessage)
        throws IOException {
    Assert.assertTrue(driver1.findElement(By.id(applangoObject.CHANGE_PASSWORD_MESSAGE.getValue().toString()))
            .getText().contains(changePasswordMessage.getValue().toString()));
}

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

public static void verifyNoAuthenticationSet(WebDriver driver1) throws IOException {
    Assert.assertTrue(driver1/*  w  w w .j  ava  2s .c  o m*/
            .findElement(By.id(applangoTextfields.APPLICATION_CLIENT_KEY.getValue().toString())).isDisplayed());
    Assert.assertTrue(
            driver1.findElement(By.id(applangoTextfields.APPLICATION_CLIENT_SECRET.getValue().toString()))
                    .isDisplayed());
    Assert.assertTrue(driver1.findElement(By.xpath(applangoButtons.AUTHENTICATION_SUBMIT.getValue().toString()))
            .isEnabled());
}