我试图使用splinter这是一个基于selenium的网页浏览包。
最初我试图运行并得到错误,即使我已经下载了chromedriver。
from splinter import Browser
browser = Browser()
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
但是我设法在brew install chromedriver
之后运行代码。我很好奇brew brew在哪里粘贴了这条路径。我查看.bash_profile并没有找到任何区别。
要找出实际文件的安装位置,请运行brew info chromedriver
。在我的机器上,这给出了路径
/usr/local/Cellar/chromedriver/2.33
这不是我的$PATH
,但在程序上运行type
告诉我们
$ type chromedriver
chromedriver is /usr/local/bin/chromedriver
这是在路上。此外,该路径是实际安装文件夹的符号链接,您可以像这样找到它
ls -l /usr/local/bin/chromedriver
lrwxr-xr-x 1 harald admin 44 Nov 25 21:08 /usr/local/bin/chromedriver -> ../Cellar/chromedriver/2.33/bin/chromedriver