Home > OS >  how to specify driver path in ruby watir 7?
how to specify driver path in ruby watir 7?

Time:08-05

While am specifying driver path in watir 7 it throws below error How to specify driver path please help

browser_opts = {driver_path: 'C:/software/SELENIUM-DRIVERS/chromedriver.exe'}

Before do
  @browser = Watir::Browser.new :chrome, browser_opts
  @browser.window.maximize
end

      {:driver_path=>"C:/software/SELENIUM-DRIVERS/chromedriver.exe"} are unrecognized arguments for Browser constructor
 (ArgumentError)
      ./features/support/hooks.rb:8:in `new'
      ./features/support/hooks.rb:8:in `Before'

CodePudding user response:

The driver path needs to be part of the service options rather than the browser options.

This would look like:

opts = {service: {path: 'C:/software/SELENIUM-DRIVERS/chromedriver.exe'}}

browser = Watir::Browser.new(:chrome, opts)
  • Related