未知错误:未处理的检查器错误:{“代码”:-32000,“消息”:“找不到具有指定ID的上下文”}

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

我正在尝试等待加载的图像从屏幕上消失

如果屏幕未加载,则元素看起来像:: >>

<div id="divWait" style="cursor: wait; position: absolute; left: 0%; top: 0%; background: transparent; padding: 3px; width: 100%; height: 100%; display: none;" xpath="1">

当屏幕加载时,元素看起来像:

   <div id="divWait" style="cursor: wait; position: absolute; left: 0%; top: 0%; background: transparent; padding: 3px; width: 100%; height: 100%; " xpath="1">

display消失

我为此编写的代码行:

w.until(ExpectedConditions.attributeContains(driver.findElement(By.xpath("//*[@id=\"divWait\"]")), "display", "none"));

值得一提的是,我的元素位于iframe中,但是我已经处理并确保可以解析iframe中的其他元素,还确保了上面使用的xpath有效(从html复制为xpath)

其他时候我遇到以下异常

stale element reference: element is not attached to the page document

我正尝试等待加载的图像从屏幕上消失,如果屏幕未加载,则该元素看起来像:

selenium selenium-webdriver driver webdriverwait
1个回答
0
投票

陈旧元素引用错误是由于引用的Web元素不再附加到DOM而发生的Web驱动程序错误。

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