UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chr

In [1]: from selenium import webdriver

In [2]: driver = webdriver.PhantomJS()
G:\Anaconda3\lib\sitepackages\selenium\webdriver\phantomjs\webdriver.py:49: 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 '

In [3]: quit()

报错的意思大概是

Selenium 已经弃用 PhantomJS ,请使用火狐或者谷歌无界面浏览器

查看selenium版本

C:\Users\zty>pip show selenium
Name: selenium
Version: 3.10.0
Summary: Python bindings for Selenium
Home-page: https://github.com/SeleniumHQ/selenium/
Author: UNKNOWN
Author-email: UNKNOWN
License: Apache 2.0
Location: g:\anaconda3\lib\site-packages
Requires:

原来目前默认安装的selenium版本为3.x

百度查得 安装2.x版本可解决此问题
so:

C:\Users\zty>pip uninstall selenium
C:\Users\zty>pip install selenium==2.48.0
Collecting selenium==2.48.0
  Downloading selenium-2.48.0.tar.gz (805kB)
    100% |████████████████████████████████| 808kB 5.1kB/s
Building wheels for collected packages: selenium
  Running setup.py bdist_wheel for selenium ... done
  Stored in directory: C:\Users\zty\AppData\Local\pip\Cache\wheels\5a\80\e9\7317945f05740b625382070b69cbccb2f37a00af0d95d4e428
Successfully built selenium
Installing collected packages: selenium
Successfully installed selenium-2.48.0

C:\Users\zty>ipython
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from selenium import webdriver

In [2]: driver = webdriver.PhantomJS()

问题解决

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值