Example usage for org.openqa.selenium By className

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

Introduction

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

Prototype

public static By className(String className) 

Source Link

Document

Find elements based on the value of the "class" attribute.

Usage

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Gets the error message./*from w w w  . j  a v  a  2  s. c om*/
 * @return the error message
 * @see com.ecofactor.qa.automation.mobile.page.LoginPage#getErrorMessage()
 */
@Override
public String getErrorMessage() {

    String errorMsg = "";
    isDisplayed(getDriver(), By.className(LOGIN_RESPONSE), MEDIUM_TIMEOUT);
    final WebElement loginResponse = getDriver().findElement(By.className(LOGIN_RESPONSE));
    if (!loginResponse.getText().isEmpty()) {
        LogUtil.setLogString("Error Message : " + loginResponse.getText(), true, CustomLogLevel.LOW);
        errorMsg = loginResponse.getText();
    }
    return errorMsg;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Gets the error text color.// w w w .j a  v  a2  s. c  om
 * @return the error text color
 * @see com.ecofactor.qa.automation.mobile.page.LoginPage#getErrorTextColor()
 */
@Override
public String getErrorTextColor() {

    LogUtil.setLogString("Get error message font color", true, CustomLogLevel.HIGH);
    isDisplayed(getDriver(), By.className(LOGIN_RESPONSE), MEDIUM_TIMEOUT);
    Object val = executeScriptByClassName(LOGIN_RESPONSE, FONT_COLOR, getDriver());
    LogUtil.setLogString("Verify if error message has font color :" + mobileConfig.get(MobileConfig.FONT_COLOR),
            true);
    LogUtil.setLogString("Error message has font color as :" + val, true);
    return String.valueOf(val);
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Gets the error text font./* w ww.  j  a v  a 2s  .  c  om*/
 * @return the error text font
 * @see com.ecofactor.qa.automation.mobile.page.LoginPage#getErrorTextFont()
 */
@Override
public String getErrorTextFont() {

    LogUtil.setLogString("Get error message font style", true, CustomLogLevel.HIGH);
    isDisplayed(getDriver(), By.className(LOGIN_RESPONSE), MEDIUM_TIMEOUT);
    Object val = executeScriptByClassName(LOGIN_RESPONSE, FONT_FAMILY, getDriver());
    LogUtil.setLogString(
            "Verify if error message has font family :" + mobileConfig.get(MobileConfig.FONT_FAMILY), true);
    LogUtil.setLogString("Error message has font family as :" + val, true);
    return String.valueOf(val);
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Checks if is loading icon not displayed.
 * @return true, if is loading icon not displayed
 *///from w w w  . j  a  v a  2  s . c  om
public boolean isLoadingIconNotDisplayed() {

    return isNotDisplayed(getDriver(), By.className(LOADING_MESSAGE), MEDIUM_TIMEOUT) && isNotLoginPage();
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * verifies the background color for the login screen.
 * @return true, if is login background color valid
 *///  ww w  .  jav a2s . c om
@Override
public boolean isLoginBackgroundColorValid() {

    isDisplayed(getDriver(), By.className(LOGIN_VIEW), MEDIUM_TIMEOUT);
    Object val = executeScriptByClassName(LOGIN_VIEW, BACKGROUND_COLOR, getDriver());
    LogUtil.setLogString("Background color :" + val, true);
    return String.valueOf(val).equalsIgnoreCase(GREY_COLOR);

}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Checks if is error info position top of login box.
 * @return true, if is error info position top of login box
 * @see com.ecofactor.qa.automation.newapp.page.LoginPage#isErrorInfoPositionTopOfLoginBox()
 *///  w w w.java  2  s.  c om
@Override
public boolean isErrorInfoPositionTopOfLoginBox() {

    LogUtil.setLogString("Check if error info message is in top of login box.", true, CustomLogLevel.HIGH);
    boolean isErrorInfoPositionTop = false;
    isDisplayed(getDriver(), By.className(LOGIN_RESP_BOX), MEDIUM_TIMEOUT);
    WebElement errorMsg = getElement(getDriver(), By.className(LOGIN_RESP_BOX), MEDIUM_TIMEOUT);
    WebElement formElement = getElement(getDriver(), By.className(LOGIN_FORM), MEDIUM_TIMEOUT);
    isErrorInfoPositionTop = (errorMsg.getLocation().y < formElement.getLocation().y) ? true : false;
    return isErrorInfoPositionTop;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Gets the error text background color.
 * @return the error text background color
 * @see com.ecofactor.qa.automation.newapp.page.LoginPage#getErrorTextBackgroundColor()
 *//*from  w  w w.j av a 2  s .  co  m*/
@Override
public String getErrorTextBackgroundColor() {

    LogUtil.setLogString("Get error text background color", true, CustomLogLevel.HIGH);
    isDisplayed(getDriver(), By.className(LOGIN_RESP_BOX), MEDIUM_TIMEOUT);
    Object val = executeScriptByClassName(LOGIN_RESP_BOX, BACKGROUND_COLOR, getDriver());
    LogUtil.setLogString(
            "Verify if error text background color is :" + mobileConfig.get(MobileConfig.ERROR_BGCOLOR), true,
            CustomLogLevel.HIGH);
    LogUtil.setLogString("Error message back ground color :" + val, true, CustomLogLevel.HIGH);
    return String.valueOf(val);
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * fetching the version Name./*  w  ww.  j av a 2s. c om*/
 * @return string.
 * @see com.ecofactor.qa.automation.newapp.page.LoginPage#versionName()
 */
@Override
public String versionName() {

    LogUtil.setLogString("Fetch version Name", true);

    clickNeedHelp();
    final WebElement versionElement = getElement(getDriver(), By.className(VERSION_NAME), MEDIUM_TIMEOUT);
    final String version_name = versionElement.getText();
    LogUtil.setLogString("Version Name:" + version_name, true);
    return version_name;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java

License:Open Source License

/**
 * Verify either the send button is clicked or not.
 * @see com.ecofactor.qa.automation.newapp.page.LoginPage#clickSendButton()
 *//* w  w  w  .jav  a2s .c o  m*/
@Override
public void clickSendButton() {

    LogUtil.setLogString("Click Send", true);
    clickNeedHelp();
    final WebElement sendButton = getElement(getDriver(), By.className(SEND_SUBMIT), MEDIUM_TIMEOUT);
    getAction().click(sendButton);
    LogUtil.setLogString("Mail Sent", true);
    WaitUtil.tinyWait();
    getAction().rejectAlert();
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.MenuPageImpl.java

License:Open Source License

/**
 * Click the menu icon from the menu page.
 * @see com.ecofactor.qa.automation.newapp.page.MenuPage#clickMenuIconOnMenuPage()
 *//*from w w  w.ja  v  a2 s . c  o m*/
@Override
public void clickMenuIconOnMenuPage() {

    setLogString("Check Menu Icon is Displayed", true);
    isDisplayed(getDriver(), By.className(MENU_PAGE_ICON), TINY_TIMEOUT);
    setLogString("Click Menu Icon", true);
    final WebElement menuIcon = getElement(getDriver(), By.className(MENU_PAGE_ICON), TINY_TIMEOUT);
    menuIcon.click();
    // getAction().click(menuIcon);
    getAction().rejectAlert();

}