PhantomJS 出现 Selenium 错误:消息:“phantomjs”可执行文件需要位于 PATH 中

2024-03-04

我正在尝试运行这个脚本:

https://github.com/Chillee/coursera-dl-all 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 并通过安装了 seleniumnpm install selenium.


你需要下载DRIVER http://phantomjs.org/

在那之后session = webdriver.PhantomJS("c:\driverPath")

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PhantomJS 出现 Selenium 错误:消息:“phantomjs”可执行文件需要位于 PATH 中 的相关文章

随机推荐