0
Do While Loop和ExpectedConditions - 可以一起使用嗎?Do While Loop和ExpectedConditions - 可以一起使用嗎?
- Iam奇怪無法找到元素/超時異常與下面列出的方法。
2.是否可以添加一個while循環,以便該方法可以檢查並執行多次?
public void waitAndClickElement(WebElement element) throws InterruptedException {
try {
this.wait.until(ExpectedConditions.elementToBeClickable(element)).click();
System.out.println("Successfully clicked on the WebElement: " + "<" + element.toString() + ">");
}catch (Exception e) {
System.out.println("Unable to wait and click on WebElement, Exception: " + e.getMessage());
Assert.assertFalse(true, "Unable to wait and click on the WebElement, using locator: " + "<" + element.toString() + ">");
}
}
我會添加另一個內部的最大嘗試嗎?感謝你的幫助 – Gbru
不,你可以把它合併到現有的。虐待編輯 – Cathal
再次非常感謝@Cathal – Gbru