Skip to content

Commit 266868e

Browse files
Karl-Philipp Richterbarancev
authored andcommitted
Adding varargs methods to ExpectedConditions in order to avoid annoying Arrays.asList
Signed-off-by: Alexei Barantsev <barancev@gmail.com>
1 parent a6f071d commit 266868e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.openqa.selenium.WebDriverException;
3131
import org.openqa.selenium.WebElement;
3232

33+
import java.util.Arrays;
3334
import java.util.List;
3435
import java.util.Optional;
3536
import java.util.logging.Level;
@@ -244,6 +245,19 @@ public String toString() {
244245
};
245246
}
246247

248+
/**
249+
* An expectation for checking that all elements present on the web page that match the locator
250+
* are visible. Visibility means that the elements are not only displayed but also have a height
251+
* and width that is greater than 0.
252+
*
253+
* @param elements list of WebElements
254+
* @return the list of WebElements once they are located
255+
*/
256+
public static ExpectedCondition<List<WebElement>> visibilityOfAllElements(
257+
final WebElement... elements) {
258+
return visibilityOfAllElements(Arrays.asList(elements));
259+
}
260+
247261
/**
248262
* An expectation for checking that all elements present on the web page that match the locator
249263
* are visible. Visibility means that the elements are not only displayed but also have a height
@@ -1332,6 +1346,17 @@ public String toString() {
13321346
};
13331347
}
13341348

1349+
/**
1350+
* An expectation for checking all elements from given list to be invisible
1351+
*
1352+
* @param elements used to check their invisibility
1353+
* @return Boolean true when all elements are not visible anymore
1354+
*/
1355+
public static ExpectedCondition<Boolean> invisibilityOfAllElements(
1356+
final WebElement... elements) {
1357+
return invisibilityOfAllElements(Arrays.asList(elements));
1358+
}
1359+
13351360
/**
13361361
* An expectation for checking all elements from given list to be invisible
13371362
*

0 commit comments

Comments
 (0)