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. Django 之 rest_framework 分页器使用

    Django rest_framework 之分页器使用以及其源码分析 三种分页方式: 常规分页 -->PageNumberPagination 偏移分页 -->LimitOffsetPa ...

  2. Linux操作系统之用户权限,重定向,文件管理

    文件的权限 ls -al  ----->隐藏文件会以 .号开头 ls -ld :显示目录自身属性 ls -i 显示文件的索引号----每个文件都有一个对应的号码 ls -r 逆序显示 dr-xr ...

  3. Python时间模块。

    python中时间的表示方式 unix时间戳,字符串时间,格式化时间 时间模块有,time,datetime,calendar #time模块 import time #获取本地时间戳,返回浮点数 p ...

  4. java.lang.IllegalArgumentException: An invalid character [34] was present in the Cookie value

    java.lang.IllegalArgumentException: An invalid character [34] was present in the Cookie value at org ...

  5. Spring Boot 中的事务管理

    希望能在发生异常的时候被回退,这时候就可以使用事务让它实现回退,做法非常简单,我们只需要在test函数上添加@Transactional注解即可. 使用@Transactional注解来声明一个函数需 ...

  6. Spring Cloud 之 Ribbon 知识点:服务器负载均衡

    Ribbon 是和 Feign 以及 Eureka 紧密协作,完成工作的,具体如下: 首先 Ribbon 会从 Eureka Client 里获取到对应的服务注册表,也就知道了所有的服务都部署在了哪些 ...

  7. javascript:location=location;">刷新</a>

    <a href="javascript:location=location;">刷新</a>

  8. Java中的Import语句如何理解?

    作用: 编译时:它只是进行语法检查和格式转换:与头文件作用相同. 运行时:依赖类加载. http://bbs.csdn.net/topics/390397328 前面说的java的编译,这里纠正一下, ...

  9. Docker报错“Dockerfile parse error line 1: FROM requires either one or three arguments”

    看官方文档Format: 以 '#' 开头一行被视为评论,出现在其他位置视为参数. 也就不难理解报错原因:将写在同一行的注释视为参数了. 原Dockerfile: 改为:

  10. 例程使用(1-4)共享内存 存图片+vector容器教程

    1传输的数据 1-1数据格式说明 1 两路视频图像Mat 图像 图像数据(Mat)+图像头信息(ImgInf) //图像的宽.高.类型信息 typedef struct { int width; // ...