ruby - 如何将 Ruby gem selenium-webdriver 与 Chromium 一起使用?

标签 ruby linux selenium debian chromium

我在使用 Ruby 2.1.5 的 Debian 8.2 “Jessie”。

test.rb 中,我有 require selenium-webdriver,但是当我运行 Selenium::WebDriver.for :ChromeDriver 时,我得到这个错误:

/var/lib/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/common/driver.rb:72:in `for': unknown driver: :ChromeDriver (ArgumentError)

我没有 Chrome,但有 Cromium。如何让 Selenium 配合?

最佳答案

*nix 系统上没有针对 Chromium 的特定驱动程序。所以你需要使用 :chrome 作为驱动程序,代替 :ChromeDriver,例如,Selenium::WebDriver.for :chrome

此外,使用此 gem 在您的执行系统上轻松安装 chromedriver:https://github.com/flavorjones/chromedriver-helper

关于ruby - 如何将 Ruby gem selenium-webdriver 与 Chromium 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34618595/

相关文章:

python - 如何以root身份运行selenium chromedriver? (即使使用 --no-sandbox 也不起作用

excel - 自动化错误。通过 Selenium 和 VBA 使用 Excel 的灾难性故障错误

ruby-on-rails - rails 加密/解密

html - rails 错误: Autoplay is only working sometimes for video_tag

可以将二进制文件中的字符串替换为不同但长度相同的字符串的 Ruby 脚本?

linux - TZ(时区)在 "/etc/crontab"中不起作用

python - 信号处理程序在线程启动后不起作用

ruby-on-rails - 我可以切换 Rails 应用程序的测试框架吗?

php - 使用php在linux中读取图像文件

performance - 为什么 selenium chromedriver 使用的资源比普通 chrome 少