等待装载程序隐藏在Selenium Web驱动程序中永远无法使用

问题描述 投票:0回答:1

我正在使用Selenium Web驱动程序,我需要等待所有加载程序消失。我在仪表板页面上有12个小部件,我需要等到所有小部件都加载完毕。加载程序显示在每个小部件上。我已经使用了以下两种方法,但没有任何效果,也没有错误,它只是传递到下一条语句。

new WebDriverWait(driver,60)
.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[contains(text(),'Loader')]"))); 
WebDriverWait wait2 = new WebDriverWait(driver,60);
wait2.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div.loader")));

This is the loader HTML, when it shows

selenium-webdriver xpath css-selectors loader webdriverwait
1个回答
0
投票

由于您在仪表板页面上总共有12个小部件,因此需要等待所有小部件加载完毕,您必须为WebDriverWait,并且您可以使用以下invisibilityOfAllElements()中的任何一个:

© www.soinside.com 2019 - 2024. All rights reserved.