我在Chrome的脚本下运行 但它在运行脚本时显示错误
要求'watir-webdriver'
b = Watir::Browser.new:chrome
b.goto 'bit.ly/watir-webdriver-demo'
b.text_field(:id => 'entry_0').set 'your name'
b.select_list(:id => 'entry_1').select 'Ruby'
b.select_list(:id => 'entry_1').selected? 'Ruby'
b.button(:name => 'submit').click
b.text.include? 'Thank you'
运行脚本时出现以下错误
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdr
iver/chrome/service.rb:19:in `executable_path': Unable to find the chromedriver
executable. Please download the server from http://code.google.com/p/chromedrive
r/downloads/list and place it somewhere on your PATH. More info at http://code.g
oogle.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverEr
ror)
答案 0 :(得分:5)
嗯,错误信息说明了一切。你必须安装chromedriver:
https://github.com/watir/watirbook/blob/master/manuscript/installation/windows.md#chrome
答案 1 :(得分:1)
您必须安装/配置ChromeDriver。以下是步骤:
答案 2 :(得分:0)
在Mac上,我发现并非所有PATH目录都有效。然而,将文件粘贴到此路径(文件夹)中对我来说很有用(确保它被称为&#39; chromedriver&#39;,而不是&#39; chromedriver2&#39;!(发生重复下载的b / c)< / p>
/用户/ [mac_account_name] /。RVM /宝石/红宝石1.9.3-P286 / bin中/
显然,我使用rvm。
(确保在添加shell后重启shell以获取更改)