watir selenium:无法识别Browser构造函数的参数



在我的rails应用程序中,我有一个运行良好的nokogiri,watir爬网程序。在我升级了我的宝石(也升级了例如硒(之后,当我用打开爬虫浏览器时

BROWSER_OPTIONS = %w[--headless --no-sandbox --disable-dev-shm-usage --disable-gpu --remote-debugging-port=9230]
Watir::Browser.new :chrome, args: BROWSER_OPTIONS

我得到以下错误:

ArgumentError: {:args=>["--headless", "--no-sandbox", "--disable-dev-shm-usage", "--disable-gpu", "--remote-debugging-port=9230"]} are unrecognized arguments for Browser constructor

来自/Users/myname/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/watir-7.1.0/lib/wtir/capabilities.rb:79:in`process_browser_options'

希望有人能帮忙。

我自己解决了。解决方案是将其更改为:

Watir::Browser.new :chrome, options: {args: BROWSER_OPTIONS}

最新更新