Sabrina
Sabrina

Reputation: 369

watir selenium: unrecognized arguments for Browser constructor

In my rails app I have a nokogiri, watir crawler that was working fine. After I upgraded my gems (also upgrading e.g. selenium), when I open the crawlers browser with:

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

I get the following error:

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

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

Hope someone can help.

Upvotes: 2

Views: 439

Answers (1)

Sabrina
Sabrina

Reputation: 369

I solved it myself. The solution was changing it to:

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

Upvotes: 4

Related Questions