Example usage for org.openqa.selenium WebElement getCssValue

List of usage examples for org.openqa.selenium WebElement getCssValue

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement getCssValue.

Prototype

String getCssValue(String propertyName);

Source Link

Document

Get the value of a given CSS property.

Usage

From source file:uk.ac.ebi.atlas.acceptance.selenium.pages.HeatmapTableWithSearchFormAndBarChartPage.java

License:Apache License

private List<WebElement> getXTicks(WebElement axisDiv) {
    List<WebElement> ticks = axisDiv.findElements(By.className("tickLabel"));

    //This is a patch because in some browser the X axis tick divs are ordered randomly,
    //but we can use the distance from X=0 to reorder the tick values
    Comparator distanceFromZeroComparator = Ordering.natural().onResultOf(new Function<WebElement, Integer>() {
        @Override//from  w  ww. j  a  va2s.co  m
        public Integer apply(org.openqa.selenium.WebElement webElement) {
            String distanceFromZero = StringUtils.substringBefore(webElement.getCssValue("left"), "px");
            return Integer.parseInt(distanceFromZero);
        }
    });
    Collections.sort(ticks, distanceFromZeroComparator);

    return ticks;
}

From source file:uk.ac.ebi.atlas.acceptance.selenium.pages.TablePage.java

License:Apache License

protected List<WebElement> getNonEmptyCellsFromFirstTableRow(WebElement table) {
    List<WebElement> nonEmptyCells = new ArrayList<>();
    for (WebElement cell : getFirstTableRow(table)) {
        if (!cell.getCssValue("background-color").equals("transparent")
                && !cell.getCssValue("background-color").equals("rgba(0, 0, 0, 0)")) {
            nonEmptyCells.add(cell);//from   w ww .j  a  v  a2  s  . c o  m
        }
    }
    return nonEmptyCells;
}