加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

selenium-webdriver – 如何在Ruby中的Jenkins服务器上设置运行C

发布时间:2020-12-17 04:02:40 所属栏目:百科 来源:网络整理
导读:我正在使用Cucumber和Capybara在Jenkins服务器上运行自动化测试.一切都适用于Firefox.但是,我遇到了设置Google Chrome和ChromeDriver的问题.我已经安装了Google Chrome和ChromeDriver(将chromedriver移动到usr / bin / chromedriver)但是当测试运行时,它会通
我正在使用Cucumber和Capybara在Jenkins服务器上运行自动化测试.一切都适用于Firefox.但是,我遇到了设置Google Chrome和ChromeDriver的问题.我已经安装了Google Chrome和ChromeDriver(将chromedriver移动到usr / bin / chromedriver)但是当测试运行时,它会通知错误:

"Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver."

以下是我在env.rb中针对Chrome驱动程序的设置:

Capybara.register_driver :chrome do |app|
    Capybara::Selenium::Driver.new(app,:browser => :chrome,:switches =>
      %w[--ignore-certificate-errors --disable-popup-blocking])
  end

如何在register_driver时设置ChromeDriver的路径?以前有没有人遇到过这个问题?
非常感谢.

解决方法

您需要将驱动程序放在PATH中,或者您应该可以调用

Selenium::WebDriver::Chrome.driver_path = <path to chromedriver>

在初始化驱动程序之前

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读