selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH

使用selenium+phantomjs的时候,出现了这样的报错信息:

selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH
  • 1

下面给出解决方法:

browser = webdriver.PhantomJS(executable_path=r'c:\user\yyduan\Desktop\phantomjs.exe')
  • 1

就是说要下载,安装 phantomjs-2.1.1-windows 
这是下载地址:http://phantomjs.org/download.html

然后文件解压就可以直接用,在代码中替换掉你自己的解压的文件路径就可以了。

猜你喜欢

转载自blog.csdn.net/eason_oracle/article/details/80067425
今日推荐