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. H3C 802.11e 协议

  2. CC2530 light_switch分析

    一些关键字: CCM  - Counter with CBC-MAC (mode ofoperation) HAL   - HardwareAbstraction Layer      (硬件抽象层) ...

  3. 【解决】修改 docker 容器时间与宿主机不同

    修改 docker 容器时间 需求: 这几天,开发提了个需求 "测试需要模拟未来某天的业务,发现容器里面没有修改时间的权限",想在我们 k8s 集群上,调整容器时间 解决方案: 使 ...

  4. Beta冲刺第2次

    二.Scrum部分 1. 各成员情况 翟仕佶 学号:201731103226 今日进展 优化了文件IO 存在问题 无 明日安排 同小小组另两人协商功能改进 截图 曾中杰 学号:201731062517 ...

  5. FFLIB

    用于分布式程序的c++类库,封装了socket.rpc.lua.CQRS框架.算法等组件,适于SNS.WEBGAME.MMO后台程序, about C++,linux https://github.c ...

  6. async 珠峰培训node正式课笔记 【async】任务流程控制,异步流程控制

    var async = require('async'); // series 串形任务 console.time('cost') async.series({ two:function(callba ...

  7. NSKeyedArchiver : NSCoder

    NSKeyedArchiver : NSCoder @interface NSData : NSObject <NSCopying, NSMutableCopying, NSSecureCodi ...

  8. swift的类型系统

    顶级抽象:protocol 具体类型:值类型.引用类型 类型操作:扩展 其他: 范型.函数式类型:function.monand

  9. RPC笔记搬迁

      选择dubbo 启动原理 解析服务 暴露服务 引用服务 提供服务流程 结合Netty 对比 HSF   https://www.cnblogs.com/lichengwei/p/5529492.h ...

  10. js-Cannot read property 'innerHTML' of null

    原因:1.$('#xxx') 或$('.xxx')不存在 2.$('#xxx')或$('.xxx')的值为空