最新版本的Selenium 不再支持 phantomjs
最新开发使用python 对网页进行截图的时候 发现 最新版本的Selenium 不在对 phantomjs进行支持
解决方法 使用 Selenium 3.01版本
#将系统中的Selenium安装的版本删除 pip uninstall Selenium #安装新版本 pip install Selenium==3.01
下面是python截图源码
#!/usr/bin/env python # -*- encoding: utf-8 -*- from selenium import webdriver import time driver = webdriver.PhantomJS('phantomjs') driver.get('http://www.baidu.com/') driver.save_screenshot('/root/111.png')</pre>