selenium + PhantomJS使用时 PhantomJS报错解决

selenium + PhantomJS使用时 PhantomJS报错解决


  • 在做动态网页爬虫时用到了selenium + PhantomJS,安装好之后运行时报错:
UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or
 Firefox instead
  warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless '

说是 Selenium 已经弃用 PhantomJS ,请使用火狐或者谷歌无界面浏览器。
查找之后得到答案时selenium的版本问题,使用pip show selenium显示默认安装的是3.8.1版本

  • 卸载之后重新pip install selenium==2.48.0安装成功
    专门写出来这个版本号是因为我使用2.0.0安装报错
     error: package directory 'buildsrcpy	est' does not exist
     ----------------------------------------
     Command "python setup.py egg_info" failed with error code 1 in           
     C:UsersOLD_DR~1AppDataLocalTemppip-build-vqjzohmyselenium
    

之后运行爬虫没有报错,搞定!!!

原文地址:https://www.cnblogs.com/jqpy1994/p/10843443.html