ubuntu 18.04刚开始在通过ruby(ruby v2.4.0)使用webdriver时获得此信息。
此版本的ChromeDriver仅支持Chrome 75版
但是
$ chromedriver -v
ChromeDriver 75.0.3770.8
(681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40})
chromedriver-helper
宝石(已弃用)和替换webdrivers
宝石都在发生这种情况,这两个宝石都表明它们是Using selenium-webdriver 2.53.3
将Ruby版本从2.4.0升级到2.4.1时出现了另一个错误:
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Traceback (most recent call last):
11: from app.rb:71:in `<main>'
10: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/capybara-2.3.0/lib/capybara/session.rb:223:in `visit'
9: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb:45:in `visit'
8: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb:13:in `browser'
7: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver.rb:84:in `for'
6: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/common/driver.rb:64:in `for'
5: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/common/driver.rb:64:in `new'
4: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/chrome/bridge.rb:34:in `initialize'
3: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/chrome/service.rb:67:in `start'
2: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked'
1: from /home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/chrome/service.rb:70:in `block in start'
/home/michael/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/selenium-webdriver-2.53.3/lib/selenium/webdriver/chrome/service.rb:115:in `connect_until_stable': unable to connect to chromedriver 127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)
尝试使用ruby 2.6.2时出现了另一个错误
未创建会话:此版本的ChromeDriver仅支持Chrome版本75(Selenium :: WebDriver :: Error :: SessionNotCreatedError)
尽管
$ chromedriver -v
ChromeDriver 75.0.3770.8
(681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40})
答案 0 :(得分:1)
更新:无法在另一台使用ruby 2.6.2的计算机上运行
不是一个好的答案,因为它不能解决问题,但是:
使用更新版本的ruby-2.6.2,浏览器可以正常工作。
因此,到目前为止,至少有2.6.2可以运行。 (实际上,我的水豚表格填写工作停止了,但我将分别进行调查)
我还遇到了其他问题,因为Ruby 2.6.2并非在所有地方都可用,但很快就会改变。