Example usage for org.openqa.selenium WebDriver findElements

List of usage examples for org.openqa.selenium WebDriver findElements

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver findElements.

Prototype

@Override
List<WebElement> findElements(By by);

Source Link

Document

Find all elements within the current page using the given mechanism.

Usage

From source file:org.auraframework.components.ui.autocomplete.AutocompleteUITest.java

License:Apache License

private WebElement getAutoCompleteList(WebDriver d, int listNumber) {
    List<WebElement> lists = d.findElements(By.cssSelector(AUTOCOMPLETE_LIST_SELECTOR));
    return lists.get(listNumber - 1);
}

From source file:org.auraframework.components.ui.autocomplete.AutocompleteUITest.java

License:Apache License

/**
 * Returns the count of the total items match
 * //w w  w  .j  av a  2  s. c  o m
 * @param d
 * @param outputNumber
 * @return
 */
private String getAutoCompleteMatchCount(WebDriver d, int outputNumber) {
    List<WebElement> outputs = d.findElements(By.cssSelector(OUTPUT_SELECTOR));
    return outputs.get(outputNumber - 1).getText();
}

From source file:org.auraframework.components.ui.autocomplete.BaseAutoComplete.java

License:Apache License

private WebElement getAutoCompleteList(WebDriver d, int listNumber) {
    List<WebElement> lists = d.findElements(By.cssSelector(AUTOCOMPLETE_LIST_SELECTOR));

    Collections.sort(lists, new Comparator<WebElement>() {
        @Override//w  w w.  j  av a  2s  . c  om
        public int compare(WebElement w1, WebElement w2) {
            String globalId1 = w1.getAttribute("data-aura-rendered-by").toString();
            String globalId2 = w2.getAttribute("data-aura-rendered-by").toString();
            String partialGlobalId1 = globalId1.substring(0, globalId1.indexOf(':'));
            String partialGlobalId2 = globalId2.substring(0, globalId2.indexOf(':'));
            int element1 = Integer.parseInt(partialGlobalId1);
            int element2 = Integer.parseInt(partialGlobalId2);
            return element1 - element2;
        }
    });

    return lists.get(listNumber - 1);
}

From source file:org.auraframework.components.ui.carousel.CarouselUITest.java

License:Apache License

private WebElement getCarousel(WebDriver d, int carouselNum) {
    List<WebElement> carousels = d.findElements(By.xpath(CAROUSEL_XPATH));
    WebElement carousel = carousels.get(--carouselNum);
    moveToCarousel(d, carousel);/* w  w  w. j  av a2  s.  co  m*/
    return carousel;
}

From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridResizeUITest.java

License:Apache License

private WebElement getSlider(WebDriver d, int colIndex) {
    return d.findElements(By.cssSelector("input[type='range']")).get(colIndex);
}

From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridResizeUITest.java

License:Apache License

private int getWidthOfColumn(WebDriver d, int colIndex) {
    return d.findElements(By.cssSelector("th[scope='col']")).get(colIndex).getSize().getWidth();
}

From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridUITest.java

License:Apache License

private void switchKeyboardMode(WebDriver wd) {
    wd.findElements(By.cssSelector(BUTTON_SELECTORS)).get(2).click();
}

From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridUITest.java

License:Apache License

private void waitForEditPanel(WebDriver d, boolean isOpen) {
    getAuraUITestingUtil().waitUntil(new ExpectedCondition<Boolean>() {
        @Override//from  w  w  w  . j a  va  2s .c  o  m
        public Boolean apply(WebDriver d) {
            List<WebElement> panel = d.findElements(By.cssSelector(INPUT_PANEL_SELECTOR));
            return isOpen == panel.size() > 0;
        }
    });
}

From source file:org.auraframework.test.perf.custom.InfiniteListComponentTest.java

License:Apache License

public void TODO_testShowMore() throws Throwable {
    // Load more data.
    WebElement element = currentDriver.findElement(By.cssSelector(".showMore"));
    element.click();/*from w  w  w  .j  ava 2s . c o  m*/

    final int expectedNumberOfRows = 50;
    waitUntil(new ExpectedCondition<Boolean>() {
        @Override
        public Boolean apply(WebDriver d) {
            return d.findElements(By.cssSelector(".listContent ul div")).size() == expectedNumberOfRows;
        }
    });
}

From source file:org.auraframework.test.perf.custom.IterationComponentTest.java

License:Apache License

public void TODO_testChangeItemValue() throws Throwable {
    // Change value of an item at index 20.
    final int rowIndex = 20;
    final String rowValue = "new test value";
    WebElement indexInputText = currentDriver.findElement(By.cssSelector(".itemIndex"));
    indexInputText.sendKeys(Integer.toString(rowIndex));
    WebElement valueInputText = currentDriver.findElement(By.cssSelector(".itemValue"));
    valueInputText.sendKeys(rowValue);/*from  w  w  w .  j a v a 2 s.c  o m*/
    WebElement button = currentDriver.findElement(By.cssSelector(".changeValue"));
    button.click();

    waitUntil(new ExpectedCondition<Boolean>() {
        @Override
        public Boolean apply(WebDriver d) {
            WebElement row = d.findElements(By.cssSelector(".container div")).get(rowIndex);
            return rowValue.equals(row.findElement(By.cssSelector(".uiOutputText")).getText());
        }
    });
}