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.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Gets the menu bar.
 *
 * @return the menu bar
 */
public WebElement getMenuBar() {
    return driver.findElement(By.className("v-menubar"));
}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Gets the menu item./*  w  w w  .  j  a  v a  2  s . c o m*/
 *
 * @param element
 *            the element
 * @param level
 *            the level
 * @param caption
 *            the caption
 * @return the menu item
 */
private WebElement getMenuItem(final WebElement element, final int level, final String... caption) {
    final List<WebElement> findElements = element.findElements(By.className("v-menubar-menuitem-caption"));
    if (caption.length == level) {
        for (final WebElement webElement : findElements) {
            if (webElement.getText().contains(caption[level - 1])) {
                return webElement;
            }
        }
    } else {
        for (final WebElement webElement : findElements) {
            if (caption[level - 1].equals(webElement.getText())) {

                return getMenuItem(webElement, level + 1, caption);
            }
        }
    }

    final List<WebElement> findElements2 = driver.findElements(By.className("v-menubar-menuitem"));
    if (caption.length == level) {
        for (final WebElement webElement : findElements2) {
            if (webElement.getText().contains(caption[level - 1])) {
                return webElement;
            }
        }
    }

    return null;
}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Gets the buttons.//w ww .  j  av a 2 s . c  om
 *
 * @return the buttons
 */
public List<WebElement> getButtons() {
    final List<WebElement> result = new ArrayList<>();
    final List<WebElement> nativeButtons = driver.findElements(By.className("v-nativebutton"));
    final List<WebElement> buttons = driver.findElements(By.className("v-button"));
    final List<WebElement> buttonsCaption = driver.findElements(By.className("v-button-caption"));

    result.addAll(nativeButtons);
    result.addAll(buttons);
    result.addAll(buttonsCaption);

    return result;
}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Gets the grid rows./*from  w w w . j  ava 2 s  . c o  m*/
 *
 * @return the grid rows
 */
public List<WebElement> getGridRows() {
    final WebElement gridBody = driver.findElement(By.className("v-grid-body"));
    return gridBody.findElements(By.className("v-grid-row"));

}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Gets the grid headers./*w  w  w .j  a  v a2  s.  c  o  m*/
 *
 * @return the grid headers
 */
public List<WebElement> getGridHeaders() {
    final WebElement gridBody = driver.findElement(By.className("v-grid-header"));

    return gridBody.findElements(By.className("v-grid-row"));

}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Close modal./* w  w w.  jav  a  2 s  .  c om*/
 *
 * @throws Exception
 *             the exception
 */
public void closeModal() throws Exception {
    final WebElement closeModalWindow = driver.findElement(By.className("v-window-closebox"));
    assertNotNull("Expect to find a Window close Box", closeModalWindow);

    performClickAction(closeModalWindow);

}

From source file:com.hotwire.selenium.bex.hotel.Disambiguation.HotelDisambiguationPage.java

License:Open Source License

public HotelDisambiguationPage(WebDriver webdriver) {
    super(webdriver, By.className("pageHeadingDisambigB"));
    PageFactory.initElements(getWebDriver(), this);
}

From source file:com.hotwire.selenium.desktop.account.AccountEmailSubscriptionsFormFragment.java

License:Open Source License

private void addToSubscriptionMap(WebElement row) {
    boolean isSubscribed = isSubscribed(row);
    String description = row.findElement(By.className("description")).findElement(By.tagName("strong"))
            .getText();/*from  www  .  j  ava 2 s . c o  m*/
    subscriptionMap.put(description, isSubscribed);
}

From source file:com.hotwire.selenium.desktop.common.billing.HotelBillingPage.java

License:Open Source License

@Override
public String getErrorMessages() {
    return errorMessages.findElement(By.className("msgBoxBody")).getText();
}

From source file:com.hotwire.selenium.desktop.details.HotelDetailsPage.java

License:Open Source License

public boolean isLPGLayerPresent() {
    lpgLink.click();//from   w w w .j  av a2s.  co  m
    return new WebDriverWait(getWebDriver(), 3)
            .until(ExpectedConditions.presenceOfElementLocated(By.className(TOOLTIP_LAYER_CLASS))).isDisplayed()
                    ? true
                    : false;
}