我正在通过 WSL2 使用 Ubuntu 22.04.1。尝试使用 Watir 进行一些抓取。
此命令:
a = Watir::Browser.new
导致此错误:
/home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.7.1/lib/selenium/webdriver/common/driver.rb:319:in `create_bridge': unknown keyword: :desired_capabilities (ArgumentError)
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.7.1/lib/selenium/webdriver/common/driver.rb:74:in `initialize'
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.7.1/lib/selenium/webdriver/common/driver.rb:47:in `new'
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.7.1/lib/selenium/webdriver/common/driver.rb:47:in `for'
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.7.1/lib/selenium/webdriver.rb:88:in `for'
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/watir-6.19.1/lib/watir/browser.rb:46:in `initialize'
from (irb):5:in `new'
from (irb):5:in `<main>'
from /home/user/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
from /home/user/.rbenv/versions/3.1.3/bin/irb:25:in `load'
from /home/user/.rbenv/versions/3.1.3/bin/irb:25:in `<main>'
我已经在 /usr/bin 中安装了 chromedriver。
任何可以修复此错误的起点都值得赞赏。
答案1
我能够通过更新 Watir 修复此问题。