I want use wait.until(ExpectedConditions) with TWO elements.
I am running a test, and I need WebDriver to wait until either of Element1 OR
If you have a variable number of conditions to satisfy, you can leverage a generic list such as Java's ArrayList<> as shown here, and then do the following:
//My example is waiting for any one of a list of URLs (code is java)
public void waitUntilUrls(List urls) {
if(null != urls && urls.size() > 0) {
System.out.println("Waiting at " + _driver.getCurrentUrl() + " for " + urls.size() + " urls");
List> conditions = new ArrayList<>();
for (String url : urls) {
conditions.add(ExpectedConditions.urlContains(url));
}
WebDriverWait wait = new WebDriverWait(_driver, 30);
ExpectedCondition[] x = new ExpectedCondition[conditions.size()];
x = conditions.toArray(x);
wait.until(ExpectedConditions.or(x)); // "OR" selects from among your ExpectedCondition array
}
}