Running watir tests on new machine throws " undefined method `chrome' for Selenium::WebDriver::Remote::Capabilities:Class"

762 views Asked by At

On old machine Selenium::WebDriver::Remote::Capabilities.chrome returns

#<Selenium::WebDriver::Remote::Capabilities:0x00007fe9d10e66f0 @capabilities={:browser_name=>“chrome”}>

On new machine returns

NoMethodError: undefined method `chrome' for Selenium::WebDriver::Remote::Capabilities:Class

I have recently gotten a new mac (macos Ventura) and am trying to get all of my tests to run. (tests with watir run on old machine)

After downloading chromedriver and starting a test I get "undefined method 'chrome'" from the watir gem.

I tracked the source of the error to the method process_capabilitiesin watir-6.19.1/lib/watir/capabilities.rb:93. The line there is caps = Selenium::WebDriver::Remote::Capabilities.send @browser, @options.merge(@w3c_caps). @browser = :chrome, @options = {} << default setting

I thought it might be a problem with chromedriver but I am able to start it locally and chromedrive is in my PATH.

I tried to start a watir instance in irb but got the same error.

which chromedriver /opt/homebrew/bin/chromedriver

echo $PATH /Users/charlie.alderete/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

chromedriver Starting ChromeDriver 117.0.5938.88 (be6afae4721209be42944bbcd325665f9f44563b-refs/branch-heads/5938_62@{#9}) on port 9515 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully.

Downloaded and installed chromedriver (117.0.5938.88) and watir (6.19.1) In IRB tried to create a watir instance watir errors with: undefined method chrome' for Selenium::WebDriver::Remote::Capabilities:Class`

1

There are 1 answers

2
titusfortner On

You need to upgrade to Watir 7 or downgrade your Selenium version. Selenium changed the methods it allows. Watir 7 is compatible, Watir 6 is not.