【发布时间】:2021-05-14 00:34:29
【问题描述】:
您好,我对 selenium 很陌生,想知道如何最好地等待元素启用。我正在编写一个测试来下载一份报告,该报告需要在出现下载按钮之前在表格中将状态设置为“完成”。我曾尝试使用 isDisplayed() 函数,但到目前为止它失败了。我还需要计时器是动态的,以便在下载之前一直检查直到报告完成。
public static boolean isElementVisible(WebElement element) throws Exception {
return element.isDisplayed();
}
public void statusCheck() throws Exception {
if(Utils.isElementVisible(status)){
downloadButton.click();
}
else{
wait(100000);
}
}
【问题讨论】:
标签: java selenium selenium-webdriver automated-tests webdriverwait