Skip to content

Commit

Permalink
Adding varargs methods to ExpectedConditions in order to avoid annoyi…
Browse files Browse the repository at this point in the history
…ng Arrays.asList

Signed-off-by: Alexei Barantsev <barancev@gmail.com>
  • Loading branch information
Karl-Philipp Richter authored and barancev committed Jan 8, 2018
1 parent a6f071d commit 266868e
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
Expand Down Expand Up @@ -244,6 +245,19 @@ public String toString() {
};
}

/**
* An expectation for checking that all elements present on the web page that match the locator
* are visible. Visibility means that the elements are not only displayed but also have a height
* and width that is greater than 0.
*
* @param elements list of WebElements
* @return the list of WebElements once they are located
*/
public static ExpectedCondition<List<WebElement>> visibilityOfAllElements(
final WebElement... elements) {
return visibilityOfAllElements(Arrays.asList(elements));
}

/**
* An expectation for checking that all elements present on the web page that match the locator
* are visible. Visibility means that the elements are not only displayed but also have a height
Expand Down Expand Up @@ -1332,6 +1346,17 @@ public String toString() {
};
}

/**
* An expectation for checking all elements from given list to be invisible
*
* @param elements used to check their invisibility
* @return Boolean true when all elements are not visible anymore
*/
public static ExpectedCondition<Boolean> invisibilityOfAllElements(
final WebElement... elements) {
return invisibilityOfAllElements(Arrays.asList(elements));
}

/**
* An expectation for checking all elements from given list to be invisible
*
Expand Down

0 comments on commit 266868e

Please sign in to comment.