我想在MAC Chrome上运行我的脚本。我执行了以下步骤
按照以下步骤执行
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome
它提供以下错误消息
Net::ReadTimeout: Net::ReadTimeout
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1376:in `request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from /Users/vertis/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver.rb:67:in `for'
from (irb):4
答案 0 :(得分:0)
下载chromedriver的最新版本并将其保存在usr / local / bin中并运行您的代码它将起作用,因为同样的事情对我有用....如果你想看看哪个版本正在运行,那么去你的chromedriver吧单击并打开终端。它会告诉你版本所以请记住你的版本应该是2.15.XXXXXX
我很确定它会对你有用!