Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的测试需要等待服务器推送更新才能从表中删除一行。如何告诉 Selenium 等到表 DOM 发生更改?
有两种方法:
您可以等待一个元素存在(或不存在)使用wait.until(ExpectedConditions.presenceOfElementSelectedBy(By.selector()))
wait.until(ExpectedConditions.presenceOfElementSelectedBy(By.selector()))
您可以测试 JQuery 是否在页面上完成((Boolean)driver.executeScript("return jQuery.active == 0"))
((Boolean)driver.executeScript("return jQuery.active == 0"))