ruby RSpec Rails测试- WARN Selenium [DEPRECATION]和TypeError:nil不隐式转换为String

vql8enpb  于 2023-04-05  发布在  Ruby
关注(0)|答案(1)|浏览(100)

开始使用rails测试并遵循this tutorial
当我用rspec/hello_world.rb运行第一个测试时
我得到以下错误:
WARN Selenium [DEPRECATION] [:capabilities]不推荐使用Selenium::WebDriver::Chrome::Driver的:capabilities参数。用途:options参数与Selenium::WebDriver::Chrome::Driver的示例配合使用。
然后呢
失效:

  1. Hello World索引页显示正确的内容Got 0 failures and 2 other errors:
    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,options)

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和发现this solution更新我的chrome驱动程序,但它仍然导致同样的错误。
我现在已经没有办法了,甚至还不能开始学习如何用Rails进行测试,所以任何帮助都将不胜感激。

nhjlsmyf

nhjlsmyf1#

更新:已在4.8.3中修复
这个错误是一个bug。在https://github.com/SeleniumHQ/selenium/issues/11815中报告了这个错误,并将在下一个版本中修复。如果你将Selenium降级到4.8.1,一切都将按预期工作。
这个弃用通知是关于如何将功能传入Selenium的。不幸的是,Watir和Capybara都是用旧方法传入的,所以需要在这些项目中修复它。(我可能应该在Selenium中弃用这种方法之前在旧项目中修复它们)。
如果你想避免在控制台中看到弃用通知,可以在代码中添加以下内容:

Selenium::WebDriver.logger.ignore :capabilities

相关问题