本文主要说明一下安装和配置python环境和webdriver
1.安装文件下载
ChromeDriver下载:
python3.5.2下载:
不同的webdriver版本对应着不同版本的chrome浏览器,具体版本对应可以查看我的另外一篇文章:
http://blog.csdn.net/ccggaag/article/details/76094025
2.配置python环境
自己看百度经验:
http://jingyan.baidu.com/article/7908e85c78c743af491ad261.html
然后我们就配置好了python环境。
3.配置webdriver
将chromdriver.exe放在python的安装路径下(一般来说python环境配置时已经配置过了)
然后打开管理员命令窗口
右键点击win,选择:命令提示符(管理员)
然后在命令行中输入如下命令:
easy_install pip pip install -U selenium
每输入一行都要回车,等待系统安装
如果是win7用户,可能会无法运行,这个时候要先进入到python的安装路径下Scripts文件夹下再运行命令才可以
例如:cd C:Program FilesPython35Scripts
4.安装完毕,实验一下
打开编辑器,并新建.py的python文件
输入:
from selenium import webdriver driver = webdriver.Chrome() driver.get("http://www.baidu.com")