提问人:RaspberryRat 提问时间:3/26/2023 更新时间:3/27/2023 访问量:303
RSpec Rails 测试 - WARN Selenium [DEPRECATION] 和 TypeError:没有将 nil 隐式转换为字符串
RSpec Rails testing - WARN Selenium [DEPRECATION] and TypeError: no implicit conversion of nil into String
问:
开始使用 rails 测试并遵循本教程。
当我使用 rspec spec/hello_world.rb 运行第一个测试时
我收到以下错误:
WARN Selenium [弃用] [:capabilities] Selenium::WebDriver::Chrome::D river 的 :capabilities 参数已弃用。请改用 :options 参数和 Selenium::WebDriver::Chrome::D river 的实例。
和
失败:
Hello World 索引页显示正确的内容 出现 0 次失败和 2 个其他错误:
1.1) 故障/错误:访问hello_world_index_path
TypeError: no implicit conversion of nil into String # ./spec/hello_world_spec.rb:9:in `block (3 levels) in <top (required)>'
1.2) 失败/错误:@pid = Process.spawn(*@command,选项)
TypeError: no implicit conversion of nil into String
堆栈跟踪显示:ruby/gems/3.1.0/gems/selenium-webdriver-4.8.2/lib/selenium/webdriver/common/child_process.rb:57:in 'spawn'
我正在使用最新的 webdrivers 和 selenium-webdriver。
我在 m1 macbook 上,找到了这个解决方案来更新我的 chrome 驱动程序,但它仍然会导致同样的错误。
我现在没有想法了,甚至无法开始学习如何使用轨道进行测试,因此任何帮助将不胜感激。
答:
更新:已在 4.8.3 中修复
该错误是一个错误。此处已报告 https://github.com/SeleniumHQ/selenium/issues/11815,并将在下一个版本中修复。如果您将 Selenium 降级到 4.8.1,一切都将按预期工作。
该弃用通知是关于如何将功能传递到 Selenium 中。不幸的是,Watir 和 Capybara 都在使用旧方法传递东西,因此需要在这些项目中修复它。(在Selenium中弃用这种方法之前,我可能应该在旧项目中修复它们)。
如果要避免在控制台中看到该弃用通知,可以将以下内容添加到代码中:
Selenium::WebDriver.logger.ignore :capabilities
评论