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.insite.page.UserManagementImpl.java

License:Open Source License

/**
 * Iterate first page and verify nve user.
 * @param partnerId the partner id// w  w w .j a  va 2s . c  o  m
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#iterateFirstPageAndVerifyNVEUser(int)
 */
@Override
public void iterateFirstPageAndVerifyNVEUser(final int partnerId) {

    DriverConfig.setLogString("Iterate Search Results", true);
    final List<WebElement> resultElements = DriverConfig.getDriver().findElements(By.id("user"));
    for (final WebElement webElement : resultElements) {
        final List<WebElement> userInfo = webElement.findElements(By.className("userinfo"));
        Assert.assertTrue(!userInfo.get(2).getText().trim().isEmpty(), "Userinfo is different");
        final String userName = userInfo.get(2).getText().trim();
        logger.info("userPartnerId: " + userName);
        final int userPartnerId = partnerAccountUserDao.getPartnerAccountByAccessLogin(userName);
        logger.info("userPartnerId: " + userName + ":" + userPartnerId);
        Assert.assertTrue(userPartnerId == partnerId, "User partnerId is different");
    }
}

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

License:Open Source License

/**
 * Read temperature.//from   www.  jav a2s .  c o m
 * @return the string
 * @see com.ecofactor.qa.automation.newapp.admin.page.AdminDialoguePage#readTemperature()
 */
@Override
public String readTemperature() {

    setLogString("Read temperature", true);
    final WebElement tempElement = getElements(popup, By.className(BLOCK), SHORT_TIMEOUT).get(1);
    final String value = getElementBySubElement(popup, tempElement, By.tagName(TAG_SPAN), SHORT_TIMEOUT)
            .getText();
    final String[] tempValue = value.split(":");
    setLogString("Hexa decimal value: " + tempValue[1].trim(), true);
    return tempValue[1].trim();
}

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

License:Open Source License

/**
 * Gets the required thermostat container.
 * @param thermostat the thermostat//from ww  w  .  ja  v a2 s. c  om
 * @return the required thermostat container
 */
private WebElement getRequiredThermostatContainer(final String thermostat) {

    setLogString("Get current temperature for thermostat : " + thermostat, true);
    WebElement thermostatTable = null;
    setLogString("Get thermostats.", true);
    driverManager.getAdminDriver().switchTo().defaultContent();
    smallWait();
    driverManager.getAdminDriver().switchTo().frame(1);
    setLogString("Retrieve the thermostat data from the filtered data.", true);

    final WebElement bodyElement = getElement(driverManager.getAdminDriver(), By.tagName(TAG_BODY),
            TINY_TIMEOUT);
    final List<WebElement> itemTables = getElementsBySubElement(driverManager.getAdminDriver(), bodyElement,
            By.className(ITEM_TABLE), TINY_TIMEOUT);

    for (final WebElement itemTable : itemTables) {
        final List<WebElement> testThermostat = getElementsBySubElementText(driverManager.getAdminDriver(),
                itemTable, By.tagName(TAG_TD), thermostat.trim(), SHORT_TIMEOUT);
        if (testThermostat.size() > ZERO) {
            thermostatTable = itemTable;
            break;
        }
    }
    return thermostatTable;
}

From source file:com.ecofactor.qa.automation.newapp.MobileUsersTest.java

License:Open Source License

/**
 * Checks if is page loaded.//from  w  ww  .  j  a  v a 2  s.co  m
 * @return true, if is page loaded
 * @throws Exception the exception
 */
private boolean isPageLoaded() throws Exception {

    LogUtil.setLogString("Verify Login is Success", true);
    isDisplayed(testOps.getDeviceDriver(), By.className(UNUSED_BTM_CONTAINER), SHORT_TIMEOUT);
    boolean isBackgroundDisplayed = isDisplayed(testOps.getDeviceDriver(), By.className(TH_AXIS_CONTAINER),
            TINY_TIMEOUT);
    boolean isPageDisplayed = isDisplayed(testOps.getDeviceDriver(), By.className(LOCATION_NAME), TINY_TIMEOUT);
    if (!isBackgroundDisplayed || !isPageDisplayed) {
        LogUtil.setLogString(LogSection.END, "Login Failed", true);
    } else {
        LogUtil.setLogString(LogSection.END, "Login Success", true);
    }
    loginPage.setLoggedIn(isPageDisplayed && isBackgroundDisplayed);
    return isPageDisplayed;
}

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

License:Open Source License

/**
 * Checks if is duration label displayed.
 * @return true, if is duration label displayed
 *//*from  www  . j  a  v  a2s. c  o m*/
@Override
public boolean isDurationLabelDisplayed() {

    return getElementByText(getDriver(), By.className("settings_title_label"), DURATION, TINY_TIMEOUT)
            .isDisplayed();
}

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

License:Open Source License

/**
 * Checks if is page loaded./*ww  w . j  a  v  a2s .  com*/
 * @return true, if is page loaded
 * @see com.ecofactor.qa.automation.newapp.page.BasePage#isPageLoaded()
 */
@Override
public boolean isPageLoaded() {

    setLogString("Verify if help overlay page is loaded.", true);
    return isDisplayed(getDriver(), By.className(HELP_DIV), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * @see com.ecofactor.qa.automation.newapp.page.HelpOverlayPage#closeHelpOverlay()
 *//* w w w  .jav  a  2  s  . c o m*/
@Override
public void closeHelpOverlay() {

    setLogString("Close Help", true);
    final WebElement closeElement = getElement(getDriver(), By.className(HELP_CLOSE), TINY_TIMEOUT);
    uiAction.click(closeElement);
}

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

License:Open Source License

/**
 * Gets the swipe container.
 * @return the swipe container
 */
private WebElement getSwipeContainer() {

    return getElement(getDriver(), By.className(SWIPE), TINY_TIMEOUT);
}

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

License:Open Source License

@Override
public void clickBackground() {

    LogUtil.setLogString("Click Location Switcher Background", true, CustomLogLevel.HIGH);
    final WebElement page = getElement(getDriver(), By.className(LOCATION_SWITCHER_BACKGROUND), TINY_TIMEOUT);
    getAction().click(page);//  w  ww.  java2 s  .c  o  m
    getAction().rejectAlert();

}

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

License:Open Source License

/**
 * Gets the no of locations.//  w ww . jav a2  s  .c  o  m
 * @return the no of locations
 * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getNoOfLocations()
 */
@Override
public int getNoOfLocations() {

    LogUtil.setLogString("Get number of locations", true, CustomLogLevel.LOW);
    final WebElement thermostatSwitcherContainer = getElement(getDriver(),
            By.className(THERMOSTAT_SWITCHER_CONTAINER), SHORT_TIMEOUT);
    final List<WebElement> locationElements = getElementsBySubElement(getDriver(), thermostatSwitcherContainer,
            By.className(LOCATION_ROW), SHORT_TIMEOUT);
    return locationElements != null ? locationElements.size() : 0;
}