我几周没有使用Watir Webdriver与Chrome,今天当我尝试使用它时,当我尝试创建一个新的浏览器实例时出错。这是得到的错误:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\kai.knutson>irb
irb(main):001:0> require "watir-webdriver"
=> true
irb(main):002:0> e = Watir::Browser.new:chrome
Started ChromeDriver
port=9515
version=18.0.1022.0
log=C:\Users\kai.knutson\chromedriver.log
.\test\automation\proxy_launcher.cc(106): error: Value of: app_launched
Actual: 1
Expected: AUTOMATION_SUCCESS
Which is: 0
Error while awaiting automation ping from browser process
[0821/155924:ERROR:proxy_launcher.cc(569)] Failed to ConnectToRunningBrowser
.\test\automation\proxy_launcher.cc(303): error: Value of: browser.get()
Actual: false
Expected: true
Selenium::WebDriver::Error::UnknownError: Unable to either launch or connect to
Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: C:
\Users\kai.knutson\AppData\Local\Google\Chrome\Application\chrome.exe
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/response.rb:52:in `assert_ok'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/response.rb:15:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/http/common.rb:59:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/http/common.rb:59:in `create_response'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/http/default.rb:59:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/chrome/bridge.rb:29:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/common/driver.rb:37:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver/common/driver.rb:37:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/s
elenium/webdriver.rb:65:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir
-webdriver/browser.rb:35:in `initialize'
from (irb):2:in `new'
from (irb):2
from C:/Ruby193/bin/irb:12:in `<main>'
答案 0 :(得分:4)
你有selenium-webdriver 2.24.0,最新版本是2.25.0。更新您的宝石(或至少是selenium-webdriver),如果问题仍然存在,请告诉我们。另外,获取最新的chromedriver:http://code.google.com/p/chromedriver/downloads/list