【发布时间】:2016-10-20 14:07:21
【问题描述】:
我正在尝试运行此脚本:
https://github.com/Chillee/coursera-dl-all
但是,脚本在session = webdriver.PhantomJS() 行失败,并出现以下错误
Traceback (most recent call last):
File "dl_all.py", line 236, in <module>
session = webdriver.PhantomJS()
File "/home/<user>/.local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
self.service.start()
File "/home/<user>/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x7f6f632864d0>> ignored
如何将 phantomjs 添加到我的 PATH 中?我正在运行 ubuntu 16.04 并通过 npm install selenium 安装了 selenium。
【问题讨论】:
-
phantomjs 安装了吗?
-
应该是。有什么办法可以复查吗?
-
做
which phantomjs。如果它不存在,只需将其移动到 /usr/bin 或 PATH 中的任何其他位置
标签: python selenium selenium-webdriver phantomjs