问题标签 [implicitwait]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
143 浏览

selenium - Selenium 获取子元素为什么慢

例如,HTML:

这个元素没有子元素,当我使用代码时:

程序用了很长的时间(大约30s)返回一个结果。结果大小是正确的,为零。那么我该如何解决这个问题呢?谢谢。

0 投票
3 回答
1789 浏览

java - 如何使用 java 在 selenium 中执行静态等待?

这很令人沮丧。在我看到的任何地方,人们一直告诉我使用显式、隐式和流畅的等待。这些等待使您可以根据元素暂停。但是,光顾我们并删除工具和选项并不是一个好主意。在我当前的特定泡菜中,我有一个按钮,如果有人点击它太快就会消失。但是,它也被设计为现在立即显示。所以你必须等到它出现,然后等待足够的时间过去,然后才点击按钮。有了这些建议,我认为这是不可能的。在这种情况下,必须使用静态暂停睡眠。出于某种原因,我什至不能使用线程睡眠,因为它似乎在 Java 8 本身或其他东西中已被弃用。

0 投票
1 回答
271 浏览

selenium-webdriver - selenium webdriver 在抛出 NoSuchElementException 之前的默认等待时间是多少

在 sellenium 中有 3 种等待类型,即隐式等待、显式等待和流畅等待。如果我不使用任何等待,selenium 在抛出之前默认等待多少时间NoSuchElementException

是硒内部使用的隐式等待吗?

0 投票
1 回答
983 浏览

selenium - 驱动程序实例必须符合 W3C 规范,以支持在使用 ImplicitWait 时获取超时值错误

我正在尝试使用 ChomeDriver 和 Selenium 设置隐式等待,但我收到一条错误消息。

行为也是超时未设置,默认为 60 秒。

我正在使用 Selenium.WebDriver 3.141.0

0 投票
2 回答
1161 浏览

java - Selenium:尽管存在不可见元素,但让 findElements 等待可见元素

我们希望将一些键发送到由名称标识的元素。在应用程序中可能有多个具有相同名称的元素,但在这种情况下,只有一个是可见的。为此,我们有一个这样的代码片段(简单的代码,没有生产代码):

如果标题元素还没有出现,我们使用隐式等待来等待它出现。所以通常这会很好。无论如何,我们有时会遇到这样的情况,即已经存在具有该名称的元素(但被隐藏了),而正确的元素只会由异步代码创建。但在这种情况下,代码将不起作用。由于findElements()将立即返回(没有隐式等待),只返回不可见的元素。在这种情况下,sendKeys()将等待元素变得可见,但这永远不会发生(忽略在 之后创建的新元素findElements),因此它在隐式等待超时后失败。

基本上,我们需要有可能告诉findElements()我们只想拥有可见元素。如果没有可见元素 Selenium 应该等待隐式等待持续时间。这可能吗?

0 投票
1 回答
45 浏览

selenium - 与 Implicitwait 相比,我们是否需要为 ExplicitWait 声明更少的时间

在某处我读到混合隐式和显式会产生不可预测的结果。这是真的吗?

资料来源:https ://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#advanceduserinteractions

警告:不要混合隐式和显式等待!这样做会导致不可预测的等待时间。例如,设置 10 秒的隐式等待和 15 秒的显式等待可能会导致 20 秒后发生超时。

在那种情况下,我们是否需要给更少的时间/等于隐式等待???

0 投票
1 回答
546 浏览

java - 当我将等待时间设为 10 秒时,自动化会等待网页加载 10 分钟

我有一个 java selenium 项目。我使用了 10 秒的隐式等待

自动化脚本仍然等待 10 分钟以加载网页。 这是将存在 10 分钟然后它将失败的图像。

可能的原因是什么?

0 投票
2 回答
294 浏览

selenium - 如果我们可以一次设置隐式等待更多的时间,那么显式等待需要什么?

我们声明了 10 秒的隐式等待,但一个元素需要更多时间,比如 20 秒,有时可能会出现 5 秒,所以在这种情况下,声明了显式等待。

任何时候隐式等待不要等待默认时间,一旦元素可见,它将停止等待

0 投票
1 回答
119 浏览

.net - Why is my explicit wait not working in Selenium .Net?

I've written a C# extension method that accepts a By for an element and tries to wait for up to 5 seconds while repeatedly polling the page to see if the element is present.

Here's the code:

For the purpose of this question, here's how I invoke the method:

Given that an element with id #not_in_page does not exist in the page and that the default polling time for the Until() method is 500 milliseconds, I would expect the code to print out something like:

However, what I'm actually getting is :

Note that the polling seems to happen only once and that the exception was thrown 60 seconds after starting to poll.

Is wait.Until() subject to an implicit wait of 60 seconds? How can I instead make it ignore it and poll once every 500 milliseconds?

0 投票
2 回答
713 浏览

selenium - 隐式等待和 AjaxElementLocatorFactory 有什么区别?

根据定义,

隐式等待是告诉 Web Driver 在尝试查找一个或多个元素(如果它们不是立即可用的)时轮询 DOM 一段时间。

请参阅隐式等待

WebElement 的超时将在 AjaxElementLocatorFactory 的帮助下分配给 Object 页面类

请参阅AjaxElementLocatorFactory

从上面看,并不清楚隐式等待和 AjaxElementLocatorFactory 之间究竟有什么区别。请解释。