Selenium Net::ReadTimeout 在没有@javascript 标签的情况下立即通过的测试 - Ruby Cucumber 测试
Selenium Net::ReadTimeout on tests that pass instantly without @javascript tag - Ruby Cucumber tests
最终编辑:我放弃了,只是完全重新安装了 WSL2 和所有东西。效果很好。因此,如果您正以某种方式处理同样的问题,硬重置可能是一个可行的选择。
我已经看过许多以前的 Stack Overflow 帖子,最值得注意的是 this one 其第二个解决方案在大多数其他关于该主题的帖子中得到了回应,即延长内部超时时间以为浏览器分配更多时间加载超过默认 60 秒的页面。
我 运行ning 的 Cucumber 测试很小(我用作基准的测试是 4 个场景,16 个步骤)并且在不使用 Selenium 时几乎立即通过,页面是大部分是静态的,我只想在以后的测试中看到它 运行+process 弹出窗口,所以我不需要更多的加载时间。
几个月前这些测试都运行良好(6 月),但是当我重新打开时相同的 repo,完全未修改现在我无法 运行 使用 selenium 进行任何测试 - 它甚至在 运行 时不再打开浏览器。因此,我觉得它与我的项目设置无关,因为它的 none 已经改变。即便如此,我已经卸载了这些宝石并重新安装它们,更新它们,但都无济于事。我不知道哪些本地系统 settings/environment 变量在这段时间可能发生了变化,因为我专门通过 WSL2 在应用程序上工作,自上次打开这个特定项目以来我没有接触过它。非常欢迎这方面的任何想法。
我为 Capybara 所做的唯一配置是在我的 env.rb
文件中的测试会话之间将 Capybara.javascript_driver
设置为 :selenium
或 :selenium_headless
,其他一切都是 运行宁默认。 My firefox and geckodriver versions are compatible.
版本:
- Ubuntu - 20.04.1 LTS
- Ruby - 2.5.3
- 火狐 - 92.0
- 壁虎驱动程序 - 0.29.1
- xfce4 - 4.14(运行
apt list -a xfce4
,因为 xfce4-about
给了我一个错误:17:02:48.578: No vendor information found in "/usr/share/xfce4/vendorinfo".
相关 (?) 宝石:
- selenium-webdriver (4.0.0.rc1)
- 网络驱动程序 (0.18.0)
- 黄瓜 (7.0.0)
- 黄瓜-rails (2.4.0)
如果需要任何类型的更多信息,请告诉我,谢谢。
编辑:相关 Github 回购:last working version from a few months ago, most recent development branch as of this post
编辑 2、4、5:将 geckodriver 日志级别设置为跟踪后的一个 Cucumber 场景的日志:
2021-09-15 17:42:19 DEBUG Selenium Executing Process ["/usr/bin/geckodriver", "--port=4444"]
2021-09-15 17:42:19 DEBUG Selenium polling for socket on ["127.0.0.1", 4444]
1631752939382 geckodriver INFO Listening on 127.0.0.1:4444
2021-09-15 17:42:19 WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.
2021-09-15 17:42:19 INFO Selenium -> POST session
2021-09-15 17:42:19 INFO Selenium >>> http://127.0.0.1:4444/session | {"capabilities":{"alwaysMatch":{"browserName":"firefox","moz:firefoxOptions":{"log":{"level":"trace"}}}}}
2021-09-15 17:42:19 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.0.0.rc1 (ruby linux)", "Content-Length"=>"105"}
1631752939650 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-no-remote" "-profile" "/tmp/rust_mozprofileqR2HiM"
1631752939651 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:46793
Net::ReadTimeout (Net::ReadTimeout)
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:181:in `rbuf_fill'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:157:in `readuntil'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:167:in `readline'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http/response.rb:40:in `read_status_line'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http/response.rb:29:in `read_new'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1494:in `block in transport_request'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1491:in `catch'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1491:in `transport_request'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1464:in `request'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/default.rb:124:in `response_for'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/default.rb:77:in `request'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/bridge.rb:589:in `execute'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/bridge.rb:52:in `create_session'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:338:in `create_bridge'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:53:in `new'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:53:in `for'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver.rb:87:in `for'
/home/nacho/Github/cs370/features/support/env.rb:18:in `<top (required)>'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `require'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `load_code_file'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:81:in `block in load_files!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `each'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `load_files!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:260:in `load_step_definitions'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:72:in `run!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/bin/cucumber:9:in `<top (required)>'
/usr/share/rvm/gems/ruby-2.5.3/bin/cucumber:23:in `load'
/usr/share/rvm/gems/ruby-2.5.3/bin/cucumber:23:in `<main>'
/usr/share/rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
/usr/share/rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
编辑 3:我一直在仔细研究日志并在谷歌上搜索各种 terms/lines,但我并没有真正想出太多我知道如何使用的东西。我做过的一些事情:
- 连接到
127.0.0.1:35213
及其变体,因为每次我 运行 测试时它都会改变,并看到我的应用程序的工作版本
- 尝试连接到它正在侦听的各种套接字,例如
127.0.0.1:4487
和 127.0.0.1:4487/session
,这在测试之间保持不变,但它要么 a) 不加载要么 b) return 一个空白页,其中文本 HTTP method not allowed
为纯文本 HTML
不确定 webdriver 0.18.0 gem 是什么?但是,如果您可以推送一个我们可以下拉和分类的回购协议,我很乐意提供帮助。
从你原来的 post 也没有任何可复制的东西。因此,一旦您有 github link,请告诉我们。我敢打赌问题是你的项目/电脑设置
我放弃了修复任何东西的尝试,只是卸载了 Ubuntu 并重新安装,再次完成了完整的安装过程,但省略了 xfce4,因为我意识到我不需要它来实现我的目的。重新开始工作,希望我能在三个小时而不是四天内完成这件事。生活和学习,我想。
最终编辑:我放弃了,只是完全重新安装了 WSL2 和所有东西。效果很好。因此,如果您正以某种方式处理同样的问题,硬重置可能是一个可行的选择。
我已经看过许多以前的 Stack Overflow 帖子,最值得注意的是 this one 其第二个解决方案在大多数其他关于该主题的帖子中得到了回应,即延长内部超时时间以为浏览器分配更多时间加载超过默认 60 秒的页面。
我 运行ning 的 Cucumber 测试很小(我用作基准的测试是 4 个场景,16 个步骤)并且在不使用 Selenium 时几乎立即通过,页面是大部分是静态的,我只想在以后的测试中看到它 运行+process 弹出窗口,所以我不需要更多的加载时间。
几个月前这些测试都运行良好(6 月),但是当我重新打开时相同的 repo,完全未修改现在我无法 运行 使用 selenium 进行任何测试 - 它甚至在 运行 时不再打开浏览器。因此,我觉得它与我的项目设置无关,因为它的 none 已经改变。即便如此,我已经卸载了这些宝石并重新安装它们,更新它们,但都无济于事。我不知道哪些本地系统 settings/environment 变量在这段时间可能发生了变化,因为我专门通过 WSL2 在应用程序上工作,自上次打开这个特定项目以来我没有接触过它。非常欢迎这方面的任何想法。
我为 Capybara 所做的唯一配置是在我的 env.rb
文件中的测试会话之间将 Capybara.javascript_driver
设置为 :selenium
或 :selenium_headless
,其他一切都是 运行宁默认。 My firefox and geckodriver versions are compatible.
版本:
- Ubuntu - 20.04.1 LTS
- Ruby - 2.5.3
- 火狐 - 92.0
- 壁虎驱动程序 - 0.29.1
- xfce4 - 4.14(运行
apt list -a xfce4
,因为xfce4-about
给了我一个错误:17:02:48.578: No vendor information found in "/usr/share/xfce4/vendorinfo".
相关 (?) 宝石:
- selenium-webdriver (4.0.0.rc1)
- 网络驱动程序 (0.18.0)
- 黄瓜 (7.0.0)
- 黄瓜-rails (2.4.0)
如果需要任何类型的更多信息,请告诉我,谢谢。
编辑:相关 Github 回购:last working version from a few months ago, most recent development branch as of this post
编辑 2、4、5:将 geckodriver 日志级别设置为跟踪后的一个 Cucumber 场景的日志:
2021-09-15 17:42:19 DEBUG Selenium Executing Process ["/usr/bin/geckodriver", "--port=4444"]
2021-09-15 17:42:19 DEBUG Selenium polling for socket on ["127.0.0.1", 4444]
1631752939382 geckodriver INFO Listening on 127.0.0.1:4444
2021-09-15 17:42:19 WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.
2021-09-15 17:42:19 INFO Selenium -> POST session
2021-09-15 17:42:19 INFO Selenium >>> http://127.0.0.1:4444/session | {"capabilities":{"alwaysMatch":{"browserName":"firefox","moz:firefoxOptions":{"log":{"level":"trace"}}}}}
2021-09-15 17:42:19 DEBUG Selenium > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.0.0.rc1 (ruby linux)", "Content-Length"=>"105"}
1631752939650 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-no-remote" "-profile" "/tmp/rust_mozprofileqR2HiM"
1631752939651 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:46793
Net::ReadTimeout (Net::ReadTimeout)
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:181:in `rbuf_fill'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:157:in `readuntil'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/protocol.rb:167:in `readline'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http/response.rb:40:in `read_status_line'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http/response.rb:29:in `read_new'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1494:in `block in transport_request'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1491:in `catch'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1491:in `transport_request'
/usr/share/rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/net/http.rb:1464:in `request'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/default.rb:124:in `response_for'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/default.rb:77:in `request'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/bridge.rb:589:in `execute'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/remote/bridge.rb:52:in `create_session'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:338:in `create_bridge'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:53:in `new'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver/common/driver.rb:53:in `for'
/usr/share/rvm/gems/ruby-2.5.3/gems/selenium-webdriver-4.0.0.rc1/lib/selenium/webdriver.rb:87:in `for'
/home/nacho/Github/cs370/features/support/env.rb:18:in `<top (required)>'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `require'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `load_code_file'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:81:in `block in load_files!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `each'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `load_files!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:260:in `load_step_definitions'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:72:in `run!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/usr/share/rvm/gems/ruby-2.5.3/gems/cucumber-7.0.0/bin/cucumber:9:in `<top (required)>'
/usr/share/rvm/gems/ruby-2.5.3/bin/cucumber:23:in `load'
/usr/share/rvm/gems/ruby-2.5.3/bin/cucumber:23:in `<main>'
/usr/share/rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
/usr/share/rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
编辑 3:我一直在仔细研究日志并在谷歌上搜索各种 terms/lines,但我并没有真正想出太多我知道如何使用的东西。我做过的一些事情:
- 连接到
127.0.0.1:35213
及其变体,因为每次我 运行 测试时它都会改变,并看到我的应用程序的工作版本 - 尝试连接到它正在侦听的各种套接字,例如
127.0.0.1:4487
和127.0.0.1:4487/session
,这在测试之间保持不变,但它要么 a) 不加载要么 b) return 一个空白页,其中文本HTTP method not allowed
为纯文本 HTML
不确定 webdriver 0.18.0 gem 是什么?但是,如果您可以推送一个我们可以下拉和分类的回购协议,我很乐意提供帮助。
从你原来的 post 也没有任何可复制的东西。因此,一旦您有 github link,请告诉我们。我敢打赌问题是你的项目/电脑设置
我放弃了修复任何东西的尝试,只是卸载了 Ubuntu 并重新安装,再次完成了完整的安装过程,但省略了 xfce4,因为我意识到我不需要它来实现我的目的。重新开始工作,希望我能在三个小时而不是四天内完成这件事。生活和学习,我想。