Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
org.openqa.selenium.NoSuchElementException:无此类元素:无法使用FluentWait查找元素_Selenium_Fluentwait - Fatal编程技术网

org.openqa.selenium.NoSuchElementException:无此类元素:无法使用FluentWait查找元素

org.openqa.selenium.NoSuchElementException:无此类元素:无法使用FluentWait查找元素,selenium,fluentwait,Selenium,Fluentwait,我从WebDriverWait改为FluentWait,因为它已被弃用,现在我遇到了一个错误 private val waitForElement = FluentWait(DriverFactory.driver).withTimeout(Duration.ofMinutes(1)).pollingEvery(Duration.ofSeconds(1)) 获取此错误: Message: org.openqa.selenium.NoSuchElementException: no such e

我从WebDriverWait改为FluentWait,因为它已被弃用,现在我遇到了一个错误

private val waitForElement = FluentWait(DriverFactory.driver).withTimeout(Duration.ofMinutes(1)).pollingEvery(Duration.ofSeconds(1))
获取此错误:

Message: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element
依照

检查元素的预期是可见的并已启用,以便您可以单击它

当您确定该元素存在于页面中,但希望等待与之交互时,您应该使用上述函数。您将获得异常,因为该元素根本不存在于页面中

因此,选项包括:

用于在元素不在中时抑制异常 或者更好的是,首先使用它来确保元素在那里,一旦它在页面上,您就可以执行另一次等待,等待它的可点击性
更多信息:

WebDriverWait真的被弃用了吗?@MateMrše有点。。。它已从核心库中删除,并移动到自己的库中。尝试使用WebDriverWait时收到的错误消息清楚地说明了这一点。@JeffC是的,我同时注意到了这一点:=
Message: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element