笔者小白在使用selenium+phantomjs的时候,出现了这样的报错信息:
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH
下面给出解决方法:
browser = webdriver.PhantomJS(executable_path=r'C:\Users\lyh\Anaconda2\phantomjs-2.1.1-windows\bin\phantomjs.exe')
就是说要下载,安装 phantomjs-2.1.1-windows
这是下载地址:http://phantomjs.org/download.html
然后文件解压就可以直接用,在代码中替换掉你自己的解压的文件路径就可以了。
注意这里使用的是windows系统,在路径前面需要加上r,参考给出的代码语句。
参考资料:
1、http://blog.csdn.net/crisschan/article/details/52849961 2017.8.3
2、http://blog.csdn.net/codechelle/article/details/65666091 2017.8.3
3、http://blog.csdn.net/bzd_111/article/details/50496500 2017.8.3
版权声明:本文为myt2000原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。