【selenium和python自动化测试环境搭建】

1.首先需要安装python,安装步骤不详细描述,请参照:http://www.cnblogs.com/jinshengshun/p/6102012.html
2.安装python时,已经包含pip,故直接使用pip安装selenium。直接在D:\Python\Scripts下输入命令安装:pip install -U selenium。(就是python的安装路径)
【selenium和python自动化测试环境搭建】
3.当再次在D:\Python\Scripts下输入命令安装:pip install -U selenium 提示selenium已经安装了,并且告诉我们安装得路径;
【selenium和python自动化测试环境搭建】

此时,python+selenium环境基本已搭建好。
考虑到和浏览器得兼容,需要装driver。本次使用的为chrome浏览器。所以需要安装Chrome driver。

下载地址为:http://download.csdn.net/detail/lansefaji/8758887

http://chromedriver.storage.googleapis.com/index.html?path=2.20/

将下载下来的.exe文件拷贝到Chrome的安装目录,并且将该目录添加到环境变量Path中

至此,环境的搭建已经完成啦,可以开始写自动化代码啦~~~