It is possible to wait for one of two elements in the page using ExpectedConditions.or()
:
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.or(
ExpectedConditions.elementToBeClickable(By.id("idNumber1")),
ExpectedConditions.elementToBeClickable(By.id("idNumber2"))
));
You can also do an OR
with a CSS selector using a comma ,
:
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#idNumber1, #idNumber2"));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…