Windows系统下PhantomJS的安装和基本用法
作者:回忆不说话 时间:2022-03-30 11:49:52
1.安装
下载网址:http://phantomjs.org/download.html
选择合适的版本。然后解压即可。
环境变量的配置:
进入解压的路径:
例如我是解压在D:\Python\phantomjs-2.1.1-windows\bin,将这个路径编辑在上图的末尾。就可以使用了。
如果刚配置好,在使用的时候,提示环境变量没有配置好的话,不妨重启一下电脑试试。
2 基本用法
引入:
from selenium import webdriver
# 使用webkit * 面浏览器
driver = webdriver.PhantomJS(executable_path=r'D:/Python/phantomjs-2.1.1-windows/bin/phantomjs.exe')
‘driver'的作用,去除里面的特殊字符的影响。
# 获取指定网页的数据
driver.get('http://news.sohu.com/scroll/')
print(driver.find_element_by_class_name('title').text)
来源:https://blog.csdn.net/qq_39138295/article/details/81542281
标签:python,phantomjs
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python3爬虫中关于Ajax分析方法的总结
2021-04-07 17:28:47
![](https://img.aspxhome.com/file/2023/9/64689_0s.png)
CSS布局之浮动(二)三列浮动
2008-08-19 12:47:00
PHP手机号码归属地查询代码(API接口/mysql)
2023-10-26 04:35:44
IE中雅黑字体给布局带来的变化
2008-06-13 11:22:00
![](https://img.aspxhome.com/file/UploadPic/20086/13/2008613122420492s.gif)
模仿PHP写的ASP分页函数
2008-04-13 06:11:00
GoLang 逃逸分析的机制详解
2023-08-06 16:46:43
![](https://img.aspxhome.com/file/2023/8/95358_0s.png)
网页对联广告代码效果大全
2007-10-25 23:16:00
JavaScript 各种动画渐变效果
2008-09-02 10:38:00
Python+Selenium+phantomjs实现网页模拟登录和截图功能(windows环境)
2023-11-17 11:00:43
![](https://img.aspxhome.com/file/2023/2/63922_0s.jpg)
网页中的平衡、对比、连贯和留白
2008-11-24 12:11:00
解决用CSS控制DIV居中失效的问题
2010-04-05 21:53:00
python 中文乱码问题深入分析
2023-06-12 19:04:37
![](https://img.aspxhome.com/file/2023/0/59140_0s.jpg)
Python中docx2txt库的使用说明
2022-03-23 18:58:46
快速掌握 Mysql数据库对文件操作的封装
2009-02-23 17:37:00
15个滑动门效果CSS导航菜单实例教程
2010-02-20 13:02:00
![](https://img.aspxhome.com/file/UploadPic/20102/20/150916p3l-29s.png)
Pandas对DataFrame单列/多列进行运算(map, apply, transform, agg)
2022-10-10 19:11:55
CSS在Internet Explorer 6, 7 和8中的差别
2009-10-26 18:14:00
![](https://img.aspxhome.com/file/UploadPic/up/2009102618430043.gif)
也谈javascript程序优化问题
2008-10-29 11:30:00
WEB设计经验-来自Microsoft
2008-05-15 07:30:00
System.Runtime.InteropServices.COMException的解决方法
2023-07-18 15:03:27