Webdriver 延迟问题

发布于 2024-10-20 18:30:46 字数 2364 浏览 1 评论 0原文

还有其他人遇到过 Webdriver 的延迟问题吗?我让它在 Cucumber 和 Capybara 上运行。而填写一张表格需要30多秒甚至几分钟的时间。由于某种原因,当 id 引用两个字段时,它将填充一个字段,然后在填充另一字段之前暂停。

另外,由于这种延迟,我遇到了超时错误。 (但它们不稳定......)

这些字段没有什么特别的。它们出现在页面加载时,并且此页面上没有 Ajax。

有人有什么想法吗?

这是错误:

execution expired (Timeout::Error)
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:126:in `readline'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:2026:in `read_status_line'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:2015:in `read_new'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1051:in `request_without_webmock'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1037:in `request_without_webmock'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:543:in `start'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1035:in `request_without_webmock'

编辑: 这可能与我运行 Cucumber 测试时已经打开了 Firefox 实例有关。尽管超时的频率减少了,但我仍然经常遇到超时,因此我认为这仍然是一个问题。

Edit2:特征文件将指定一个步骤: 我完成了个人信息

该步骤将进一步定义为其他步骤:

And /^I complete personal info$/ do
  fill_in('first_id', :with => "foo")
  fill_in('second_id', :with => "bar")
  ...more fill_ins...
end

Capybara 有时会找到 first_id 并且我的场景的其余部分执行良好。其他时候,它会超时。在我看来,这是非常不可预测的。还有一些时候,它会找到 first_id 但找不到 second_id。顺便说一句,这些id确实存在于页面上。

我应该包含有关该错误的更多信息。它通常看起来像这样:

...all that stuff I included in the error above...
./features/step_definitions/web_steps.rb:107
./features/step_definitions/web_steps.rb:11:in `with_scope'
./features/step_definitions/web_steps.rb:105:in `/^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/'
/my feature file:30:in 'Then we verify stuff we just filled out'

然后我们验证我们刚刚填写的内容是通过这些附加步骤定义的:

And %{I should see "foo"}
And %{I should see "bar"}

我希望这些额外的信息有帮助!如果您还有其他需要,请在评论中告诉我。

Is anyone else experiencing a latency issue with Webdriver? I have it running on Cucumber with Capybara. And it takes more than 30 seconds or even minutes to fill in a form. For some reason, it will fill in one field and then pause before filling in another field when both are referenced by id.

Also, I'm running into Timeout Errors because of this latency. (But they are erratic...)

There isn't anything special about the fields. They appear on page load and there is no Ajax on this page.

Anyone have any ideas?

Here's the error:

execution expired (Timeout::Error)
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/protocol.rb:126:in `readline'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:2026:in `read_status_line'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:2015:in `read_new'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1051:in `request_without_webmock'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1037:in `request_without_webmock'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:543:in `start'
     /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/net/http.rb:1035:in `request_without_webmock'

Edit: This might be related to the fact that I had a Firefox instance already open when I ran the Cucumber tests. Although the frequency of timeouts decreased, I still get them often enough that I think it's still an issue.

Edit2: Feature file will specify a step:
And I complete personal info

The step will be further defined as other steps:

And /^I complete personal info$/ do
  fill_in('first_id', :with => "foo")
  fill_in('second_id', :with => "bar")
  ...more fill_ins...
end

Capybara will find first_id sometimes and the rest of my scenario executes fine. Other times, it will time out. It's very unpredictable, in my opinion. Still other times, it'll find first_id but not find second_id. These ids do indeed exist on the page, by the way.

I should have included more information about the error. It will often look like this:

...all that stuff I included in the error above...
./features/step_definitions/web_steps.rb:107
./features/step_definitions/web_steps.rb:11:in `with_scope'
./features/step_definitions/web_steps.rb:105:in `/^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/'
/my feature file:30:in 'Then we verify stuff we just filled out'

Then we verify stuff we just filled out is defined with these additional steps:

And %{I should see "foo"}
And %{I should see "bar"}

I hope this extra information helps! If you need anything else, please let me know in the comments.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

つ低調成傷 2024-10-27 18:30:46

我不熟悉 webmock,但看看回溯,这不太可能是罪魁祸首 - 因为 WebDriver 使用 HTTP 与 Firefox 通信,特别是默认情况下的 Net::HTTP。

要确认这一点,您可以告诉 WebDriver 使用 Curb,希望如此不会受到 webmock 的影响。

I'm not familiar with webmock, but looking at the backtrace it's not unlikely that's the culprit - since WebDriver uses HTTP to communicate with Firefox, and specifically Net::HTTP by default.

To confirm this, you can tell WebDriver to use Curb instead, which hopefully won't be affected by what webmock does.

素染倾城色 2024-10-27 18:30:46

您遇到的问题是由 WebMock 引起的,它破坏了默认的 Net::HTTP 行为。此问题现已在 WebMock 1.7.0 中修复

The problem you experienced was caused by WebMock which broke default Net::HTTP beheviour. This issue is now fixed in WebMock 1.7.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文