我正在使用watir-webdriver并在打开Chrome浏览器时收到此错误消息:
C:\chromeDriver>irb
DL is deprecated, please use Fiddle
irb(main):001:0> require "watir-webdriver"
=> true
irb(main):002:0> a = Watir::Browser.new (:chrome)
Started ChromeDriver
port=9515
version=0.8
log=C:\chromeDriver\chromedriver.log
Selenium::WebDriver::Error::UnknownError: unknown error: unrecognized chrome option:
detach
(Driver info: chromedriver=0.8,platform=Windows NT 6.2 x86_64)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:98:in `create_session'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver.rb:67:in `for'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/watir-webd river/browser.rb:46:in `initialize'
from (irb):2:in `new'
from (irb):2
环境:
答案 0 :(得分:1)
根据例外情况,您使用的是selenium-webdriver版本2.33.0。我的猜测是这个版本和你的chromedriver之间存在不兼容性。
假设您使用的是最新的chromedriver,您可能需要更新到最新的selenium-webdriver,即版本2.35.1。
尝试:
gem install selenium-webdriver
答案 1 :(得分:1)
下载新的Chrome驱动程序 http://chromedriver.storage.googleapis.com/index.html?path=2.4/
我遇到了同样的问题并更新了Chrome驱动程序,问题得到了解决。我也更新了我的宝石。