Adding varargs methods to ExpectedConditions in order to avoid annoying Arrays.asList
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;
@@ -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
@@ -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
*
