如果显示进度条,则暂停代码执行



我使用此代码暂停代码执行:

new WebDriverWait(driver, 30).until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@class='ngx-loading-text center-center' and starts-with(., 'Loading')]")));

不幸的是,html代码是这样更改的:

<ngx-spinner _ngcontent-eas-c0="" bdcolor="rgba(255, 255, 255, 0.9)" color="#0070A0" size="medium" type="square-jelly-box" _nghost-eas-c1="">
<!---->
<div _ngcontent-eas-c1="" class="overlay" style="background-color: rgba(255, 255, 255, 0.9); position: fixed;">
<div _ngcontent-eas-c1="" class="la-square-jelly-box la-2x" style="color: rgb(0, 112, 160);">
<!---->
<div _ngcontent-eas-c1=""></div>
<div _ngcontent-eas-c1=""></div>
</div>
<div _ngcontent-eas-c1="" class="loading-text"><span _ngcontent-eas-c0="" class="spinner">Please Wait ...</span></div>
</div>
</ngx-spinner>

我试图实现这个代码";

new WebDriverWait(driver, 30).until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@class='spinner' and starts-with(., 'Loading')]")));

但代码执行不会暂停。你能建议如何正确执行他的建议吗?

查看此xpath是否有效。

wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@class='loading-text']/span[@class='spinner']"))

相关内容

  • 没有找到相关文章

最新更新