我应该将 chromedriver 文件放在哪里?

Where should I place my chromedriver file?

我正在使用 Ubuntu 14.04。我有一个 Rails 应用 "project" 位于 home/user/project。我想将 ChromeDriver 与 SeleniumWebdriver 一起使用。我下载了 ChromeDriver 可执行文件,但 Selenium 找不到该文件。它给了我这个错误:

Selenium::WebDriver::Error::WebDriverError: 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

我花了一个多小时阅读 articles/questions 关于 PATH 和环境变量的内容,他们一直在谈论编辑 ~/.profile 和 ~/.bashrc 以及 ~/.pam_environment, 但据我所知,我的电脑甚至没有任何这些文件。

不是只有一些文件夹可以放置 ChromeDriver 可执行文件以便 Selenium 可以找到它吗?

将文件放入 /home/user/project 并将 PATH=/home/user/project:$PATH 添加到您的 ~/.bashrc 文件中。如果不存在,则创建它。