selenium已经放弃PhantomJS了,建议使用火狐或者谷歌无界面浏览器。
使用无界面浏览器
Selenium+Headless Firefox Selenium+Headless Firefox和Selenium+Firefox,区别就是实例option的时候设置-headless参数。 前提条件:
- 本地安装Firefox浏览器
- 本地需要geckodriver驱动器文件,如果不配置环境变量的话,需要手动指定executable_path参数。
下载geckodriver驱动器文件 测试:
# -*- coding:utf-8 -*-
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options def main():
options = Options()
options.add_argument('-headless')
driver = Firefox(executable_path='/Users/loaderman/Documents/geckodriver', firefox_options=options)
driver.get("https://www.baidu.com")
print(driver.page_source)
driver.close() if __name__ == '__main__':
main()

使用PhantomJS报warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless '解决方法的更多相关文章

  1. selenium抓取淘宝数据报错:warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless

    ssh://root@192.168.33.12:22/root/anaconda3/bin/python3 -u /www/python3/maoyantop100/meishi_selenium. ...

  2. PhantomJS报错warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless '

    原因:Selenuim已经放弃PhantomJS3.x了,建议使用火狐或者谷歌无头浏览器. 解决方法: 1.phantomjs降级,换个2.x版本的 2.使用无头浏览器,示例代码(自己改了改,如有错误 ...

  3. Selenium support for PhantomJS has been deprecated, please use headless

    今天在使用Selenuim+PhantomJS动态抓取网页时,出现如下报错信息: C:\Python36\lib\site-packages\selenium-3.11.0-py3.6.egg\sel ...

  4. navicat连接oracle数据库报ORA-28547: connection to server failed, probable Oracle Net admin error错误的解决方法

    原文:navicat连接oracle数据库报ORA-28547: connection to server failed, probable Oracle Net admin error错误的解决方法 ...

  5. dubbo-admin-2.5.3 运行报错: Bean property 'URIType' is not writable or has an invalid 解决方法

    因为 jdk 是1.8的版本,和 dubbo-admin 存在兼容性问题.所以报错: Bean property 'URIType' is not writable or has an invalid ...

  6. 〖Android〗arm-linux-androideabi-gdb报 libpython2.6.so.1.0: cannot open shared object file错误的解决方法

    执行: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gdb out/target/p ...

  7. 关于import android.support.v4.app.ContextCompat;找不到contextcompat的解决方法

    android迁移到了androidx,那么相关库的import就有问题了,需要转变为androidx的,这里比如 import android.support.v4.app.ContextCompa ...

  8. mybatis报错(三)报错Result Maps collection does not contain value for java.lang.Integer解决方法

    转自:https://blog.csdn.net/zengdeqing2012/article/details/50978682 1 [WARN ] 2016-03-25 13:03:23,955 - ...

  9. Tomcat启动web项目报Bad version number in .class file (unable to load class ...)错误的解决方法

    一.发现问题:启动 tomcat 控制台报该错误.   二.原因:tomcat 的 jdk 版本和编译.class的 jdk 版本不一致.   三.解决办法:   步骤一: 查看 MyEclipse ...

随机推荐

  1. 手写神经网络Python深度学习

    import numpy import scipy.special import matplotlib.pyplot as plt import scipy.misc import glob impo ...

  2. PHP操作MYSQL--PDO

    感觉比直接弄SQL语句高级,但还不到ORM的封装. 一步一步进化. app.json { "db": { "user": "root", & ...

  3. sublime设置代码缩进

    打开sublime的首选项(Preferences)下的设置-用户(Setting-User) ,配置如下代码 , "translate_tabs_to_spaces": true ...

  4. server 2012/2016上,任务管理器性能页面增加磁盘监控

    1.用管理员身份启动命令行 2.命令行中输入:diskperf -y 3.关闭之前打开的任务管理,重新打开,发现可爱的磁盘监视器出现了.

  5. 28、Python网络编程

    一.基于TCP协议的socket套接字编程 1.套接字工作流程 先从服务器端说起.服务器端先初始化Socket,然后与端口绑定(bind),对端口进行监听(listen),调用accept阻塞,等待客 ...

  6. LeetCode 911. Online Election

    原题链接在这里:https://leetcode.com/problems/online-election/ 题目: In an election, the i-th vote was cast fo ...

  7. 第六次作业--static关键字、对象

    ##题目一 ##Computer package Train.Method.TeachDemo.Thread.Fuction; /** * 求n的阶乘算法 * @author 喵 * @date 20 ...

  8. 使用 ML.NET 对 K-Means 平均值聚类分析和分类

    数据集 :https://en.wikipedia.org/wiki/Iris_flower_data_set 聚类分析 非监管式机器学习任务,用于将数据实例分组到包含类似特性的群集. 聚类分析还可用 ...

  9. Linux OOM一二三

    Linux开发一般会遇到“/proc/sys/vm/overcommit_memory”,即文件/etc/sysctl.conf中的vm.overcommit_memory,Overcommit的意思 ...

  10. 一篇文章把你带入到JavaScript中的闭包与高级函数

    在JavaScript中,函数是一等公民.JavaScript是一门面向对象的编程语言,但是同时也有很多函数式编程的特性,如Lambda表达式,闭包,高阶函数等,函数式编程时一种编程范式. funct ...