码迷,mamicode.com
首页 > 编程语言 > 详细

python+selenium环境搭建

时间:2017-04-20 10:00:31      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:security   option   安全   ref   点击   packages   保护模式   str   生成   

一、python安装:
下载安装python,安装目录为:E:\Auto\Python27


二、pip安装:
进入E:\Auto\Python27\Scripts,点击easy_install-2.7.exe与pip2.7.exe


三、环境变量配置:
path中添加E:\Auto\Python27;E:\Auto\Python27\Scripts


四、检查python与pip环境配置:
cmd框中输入:python与pip检查环境变量是否配置成功


五、selenium安装:
使用pip安装selenium,pip install selenium


六、检查selenium的安装是否成功:
cmd---》python---》from selenium import webdriver等等


七、报告的生成:
下载HTMLTestRunner.py放入到E:\Auto\Python27\Lib\site-packages目录下


八、使用IE进行测试:
1)下载IEDriverServer.exe(http://www.seleniumhq.org/download/)并放入到E:\Auto\Python27目录下
2)注意点:由于IE浏览器涉及到安全保护问题,因此要将保护模式全部去掉,操作方式:设
置- -》internet options---》security--》Lnternet / Local intranet / Trusted sites / Restric
ted sites---》分别去掉Enable Protected Mode前面的打钩
3)谷歌驱动32位:http://chromedriver.storage.googleapis.com/index.html


九、使用谷歌、火狐进行测试,不需要安装浏览器驱动,直接下载安装geckodriver
下载路径为:https://github.com/mozilla/geckodriver/releases
使用方法:将下载的geckodriver.exe放置到安装firefox路径下,如(C:\Program Files (x86)\Mozilla Firefox)

python+selenium环境搭建

标签:security   option   安全   ref   点击   packages   保护模式   str   生成   

原文地址:http://www.cnblogs.com/syw20170419/p/6737127.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!