selenium使用
简介:
web自动化测试工具;可以直接运行在浏览器上,支持所有主流浏览器;可以接受指令,让浏览器自动加载页面,获取需要的数据。
1.下载浏览器驱动
-
查看自己浏览器版本
-
下载对应驱动
http://chromedriver.storage.googleapis.com/index.html
- 把chromedriver.exe放到与你的python解释器同一路径
2.selenium基本使用
- selenium的导包:from selenium import webdriver
- selenium创建driver对象:webdriver.chrome()
- selenium请求数据:driver.get(“http://www.baidu.com/”)
发表评论