2016-01-05 41 views
4

我正在使用Cucumber的黃瓜在Jenkins服務器上運行自動化測試。一切工作正常與Firefox。但是,我遇到了設置Google Chrome和ChromeDriver的問題。我已經安裝了谷歌Chrome和ChromeDriver(移動chromedriver到usr/bin中/ chromedriver),但是當測試運行時,將錯誤通知:如何設置在Chrome上Jenkins服務器上運行的Cucumber的ChromeDriver路徑?

"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." 

下面是我在env.rb安裝Chrome瀏覽器的驅動程序:

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

如何在register_driver時設置ChromeDriver路徑?有沒有人遇到過這個問題? 非常感謝。

+0

你需要把鉻司機在'PATH'變量,你正在運行測試的機器上...你執行'回聲$ PATH「命令並檢查是否有chromedriver路徑。 – Paras

回答

4

你要麼需要把驅動程序的路徑,也應該能夠初始化驅動

0

您必須下載ChromeDriver之前調用

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

。解壓縮文件並將其放入PATH中的任何文件夾中。簡而言之,將文件移動到Ruby文件夾,可能是C:\ Ruby22-x64 \ bin

0

請將chromedriver.exe放在與ruby.exe相同的文件夾/位置。這對我有用

5

對於硒3.x這個Selenium::WebDriver::Chrome.driver_path = <path to chromedriver>已棄用。現在,你必須把chrome_driver路徑驅動程序的聲明:

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

相關問題