selenium测试-open chrome
通过selenium来打开浏览器测试之前,需要确认本地已安装相应的webdriver,本例以chrome为例。
1. 查看本地chrome版本,以此确认需要安装的webdriver版本
查看chrome的help信息,确认chrome版本是v66
2. 下载相应的webdriver
下载地址:http://chromedriver.storage.googleapis.com/index.html
每个版本的文件夹中都有note信息,通过note信息来确认下载匹配chorme版本的webdriver。本地需要下载的是V2.38。
3. 将webdriver添加至环境变量
新建目录:c:\driver,并将下载的chrome的webdriver存储于此

将c:\driver添加至环境变量。
4. 编写程序测试open browser
from selenium import webdriver driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
print(driver.title) driver.quit()
百度通过chrome打开成功。
5. 测试过程中遇到的问题
程序运行后报错:
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host。
原因是chrome的webdriver驱动版本与chrome版本不匹配,下载正确的webdriver版本2.38,测试ok。
6. 相关资料阅读:
http://www.testclass.net/selenium_python/selenium3-browser-driver/
https://blog.csdn.net/javalixy/article/details/77874715
selenium测试-open chrome的更多相关文章
- python:selenium测试登录在chrome中闪退
		
问题描述:使用selenium.webdriver时测试网页,进行自动登录测试总是在登录成功时闪退.使用指定驱动器位置的方式chrome也会闪退 1.正常使用chrome驱动打开一个网页,正常访问 f ...
 - [Selenium] 如何使用Chrome Options 定制测试Chrome 浏览器的特定属性 (类似FirefoxProfiles)
		
Chrome Options 类似于FirefoxProfiles,用于定制待测试的Chrome 浏览器的特定属性 1)如果希望测试某个浏览器插件,可通过addExtensions方式提前加载以.cr ...
 - Jenkins 十二: 集成 selenium 测试
		
我的selenium采用的是python版本. 其实 selenium java版本也类似. 1. 在jenkins里面新建selenium 测试项目. 源码管理采用 “Subversion”,输入 ...
 - Centos 7.6 安装selenium+firefox+google chrome(支持xshell运行)
		
1. 查看Linux 版本 [root@penguin selenium]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) ...
 - 『心善渊』Selenium3.0基础 — 2、Selenium测试框架环境搭建(Windows)
		
目录 1.浏览器安装 2.浏览器驱动下载 (1)ChromeDriver for Chrome (2)Geckodriver for Firefox (3)IEDriverServer for IE ...
 - selenium测试框架使用xml作为对象库
		
之前已经写过一篇: selenium测试框架篇,页面对象和元素对象的管理 上次使用的excel作为Locator对象管理,由于excel处理不够方便,有以下缺点: 不能实现分page 加载Locato ...
 - VS2010+Selenium测试脚本设计
		
VS2010+Selenium测试脚本设计 http://www.docin.com/p-755903506.html
 - Selenium测试规划
		
开源工具经过近几年的发展,已经出现了一大批成熟的可应用到实际项目中的产品,其中,在WEB自动化测试领域,Selenium支持广泛的浏览器和脚本开发语言,高效的执行效率,获得广泛的应用. 本课程结合Se ...
 - selenium webdriver启动Chrome浏览器后无法输入网址的解决办法
		
通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...
 
随机推荐
- leetcode-最长无重复字符的子串
			
参考他的人代码:https://blog.csdn.net/littlebai07/article/details/79100081 给定一个字符串,找出不含有重复字符的最长子串的长度. 示例 1: ...
 - CSP201403-2:窗口
			
引言:CSP(http://www.cspro.org/lead/application/ccf/login.jsp)是由中国计算机学会(CCF)发起的"计算机职业资格认证"考试, ...
 - LeetCode 96——不同的二叉搜索树
			
1. 题目 2. 解答 以 \(1, 2, \cdots, n\) 构建二叉搜索树,其中,任意数字都可以作为根节点来构建二叉搜索树.当我们将某一个数字作为根节点后,其左边数据将构建为左子树,右边数据将 ...
 - Machine Learning分类:监督/无监督学习
			
从宏观方面,机器学习可以从不同角度来分类 是否在人类的干预/监督下训练.(supervised,unsupervised,semisupervised 以及 Reinforcement Learnin ...
 - Python3 小工具-TCP半连接扫描
			
from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...
 - 收割大厂offer需要具备的条件
			
转载出处 本人也一直在关注互联网,觉得还是有些了解.互联网要求是越来越高了,竞争的人太多了,不过你不用担心,个人觉得,你到了中层的水平,拿二线offer应该没问题,人多也有人多的好处,我比别人多努力一 ...
 - Keil ARM-CM3 printf输出调试信息到Debug (printf) Viewer
			
参考资料:http://www.keil.com/support/man/docs/jlink/jlink_trace_itm_viewer.htm 1.Target Options -> De ...
 - P4编程环境搭建遇到的问题与解决方法
			
在经历了无数的折腾之后,算是折腾,最后采用的是陈翔学长的脚本加上可爱的shell调整装好的. 链接:p4Install 也许是ubuntu18.04的问题,也有可能是我自己把这个系统折腾的有点杂乱的原 ...
 - UVA725	Division (暴力求解法入门)
			
uva 725 Division Write a program that finds and displays all pairs of 5-digit numbers that between t ...
 - 分页查询es时,返回的数据不是自己所期望的问题
			
在进行es分页查询时,一般都是用sql语句转成es查询字符串,在项目中遇到过不少次返回的数据不是自己所期望的那样时,多半原因是自己的sql拼接的有问题. 解决办法:务必要保证自己的sql语句拼接正确.