How to set the path to ChromeDriver for Cucumber running on a Jenkins server in Ruby?

I am using Cucumber with Capybara to run an automation test on a Jenkins server. Everything works fine with Firefox. However, I’m having trouble setting up Google Chrome and ChromeDriver. I installed Google Chrome and ChromeDriver (I moved the chrome recorder to usr / bin / chromedriver), but when I run the test, it notifies me of an error:

"Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver." 

Below is my setup in env.rb for the Chrome driver:

  Capybara.register_driver :chrome do |app|
    Capybara::Selenium::Driver.new(app, :browser => :chrome, :switches =>
      %w[--ignore-certificate-errors --disable-popup-blocking])
  end

How to set the path to ChromeDriver when register_driver? Has anyone experienced this problem before? Many thanks.

+4
source share
4 answers

PATH,

Selenium::WebDriver::Chrome.driver_path = <path to chromedriver> 

+4

3.x Selenium::WebDriver::Chrome.driver_path = <path to chromedriver> . chrome_driver :

Capybara::Selenium::Driver.new(app, :browser => :chrome, :driver_path => <path to chromedriver>)

+5

ChromeDriver. , PATH. , Ruby, , C:\Ruby22-x64\bin

0

Place the chromedriver.exe file in the same folder / folder as ruby.exe. It worked for me

0
source

Source: https://habr.com/ru/post/1622886/


All Articles