Selenium + Python 环境搭建

本文详细介绍如何搭建基于Python的Selenium自动化测试环境,包括Python、Selenium、ChromeDriver及IEDriver的安装与配置,提供了具体步骤和调试运行示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装Python(版本为pyton3.x),安装时注意选择添加环境变量Path,该安装包为.exe程序,双击安装即可;下载网址https://www.python.org/downloads

 

2.cmd进入命令提示符窗口,输入 python命令,检查是否配置好环境变量

 

3.安装Selenium(版本为3.50),解压安装包,在命令提示符窗口cd进入目录,C:\selenium\selenium3.50 并用python setup.py install命令安装

 

4.安装Chrome Driver,浏览器版本60,Driver版本为2.30;放到chrome的安装目录下...\Google\Chrome\Application\ ,然后设置path环境变量,把chrome的安装目录(C:\Program Files\Google\Chrome\Application)加入到path中,调试运行:

# coding = utf-8

from selenium import webdriver

driver = webdriver.Chrome()

driver.get('http://baidu.com')

#driver.quit()

 

5.安装IE Driver,浏览器版本11.483.15063,Driver版本为3.5.0.0(64位),放到IE的目录下C:\Program Files (x86)\Internet Explorer ,然后设置path环境变量,把IE目录加入到path中,调试运行:

#coding =utf - 8

from selenium import webdriver

driver =webdriver.Ie()

driver.get('http://www.baidu.com')

print(driver.title)

#driver.quit()

 

6.资料URL:

selenium + python自动化测试环境搭建 http://www.cnblogs.com/fnng/archive/2013/05/29/3106515.html

chromedriver与chrome关系表&下载 http://blog.youkuaiyun.com/huilan_same/article/details/51896672

Selenium IEDriverServer&下载 http://blog.youkuaiyun.com/jichuang123/article/details/53008581

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值