ruby - Watir 无法找到 Mozilla geckodriver

标签 ruby selenium firefox

我正在使用 Watir 来抓取一些东西,但是它抛出

Unable to find Mozilla geckodriver. Please download the server from https://github.com/mozilla/geckodriver/releases and place it

我已经完成了以下步骤。

正在下载最新的firefox(50.0版)

我从 https://github.com/mozilla/geckodriver/releases 下载了最新版本的 geckodriver , 并将其放入 ~/geckodriver

然后将 export PATH=$PATH:~/geckodriver 添加到 ~/.bash_profile 并获取它。

这是我执行的代码

require 'watir-webdriver'
browser = Watir::Browser.new :firefox # should open a new Firefox window
browser.goto 'http://nitrowriters.com/form/form.html' # or type the local path to your downloaded copy

gem 文件

source "https://rubygems.org"
gem  'nokogiri'
gem  'watir-webdriver'
gem  'open_uri_redirections'
gem  'selenium-webdriver'
gem  "watir", ">= 6.0.0.beta2"

环境:OSX 10.10

最佳答案

我在 Linux Mint 17.2 上遇到了同样的问题。我通过移动 geckodriver 文件从提取的 tar usr/bin 解决了这个问题(你必须有 root允许这样做)。

由于某些原因,如果我在我的 path 变量中定义它,zsh 将找不到它。也许其他人有更好的解决方案,但现在这个可行。

关于ruby - Watir 无法找到 Mozilla geckodriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40669953/

相关文章:

javascript - 发布到 map 显示的限制

ruby - 如何合并两个哈希数组?

ruby 线程 : how to join threads from different places so that they are concurrent?

python - Selenium Webdriver - Python - leboncoin - pb 选择带重音的按钮

css - 如何在 Firefox 和 Safari 中模拟 SVG `pointer-events: bounding-box`

css - 有没有办法在 Nokogiri css 中转义非字母数字字符?

java - 使用 selenium web 驱动程序启动浏览器,在添加 jar 文件时我不会得到任何选项,如添加外部 jar 文件

javascript - 使用 Selenium JS Chrome Webdriver 时出错

javascript - 如何在 Firefox 中从 JavaScript 解析 HTML?

image - 为什么 Firefox 似乎没有缓存图像?