我正在使用 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/