一次失败的Selenium chromedriver切换
2016-02-15 14:22
260 查看
背景
Selenium webdriver一直使用Firefox作为浏览器来跑webtest, 但是最近发现ff有时会报超时的错误,于是想到使用chromedriver来提升稳定性。本想只把.firefox() 换成 .chrome() 这么简单的事情,结果却引出很多问题。做法
根据官方文档下载chromedriver binary
放到Linux 默认路径
走起…
问题来了
问题
Selenium 报无法启动chrome, 报错selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.0.36-gentoo x86_64)
排错
用本机来跑, 排除Selenium Grid的因素更新Selenium和webdriver 到最新
添加 –no-sandbox 参数
还是跪了,用最小的测试依赖来跑,并生成chromedriver log,把问题丢给google chrome 团队了
test_chrom_min.py
from selenium import webdriver service_log_path = 'chromedriver.log' service_args = ['--verbose', '--no-sandbox'] driver = webdriver.Chrome('/usr/bin/chromedriver', service_args=service_args, service_log_path=service_log_path) driver.get('http://www.google.com/xhtml') driver.quit()
后续
在Mac上可以成功跑通,估计是测试环境上的问题Reported Bug https://bugs.chromium.org/p/chromedriver/issues/detail?id=397#c43
相关文章推荐
- ViewPager详解-----CodeParanoia
- 消息循环占用100%的cpu,添加sleep即可
- 3D数学基础图形知识点
- POJ2594Treasure Exploration(非简单路径覆盖)
- git first commit
- Java String类的Split以竖线作为分隔符
- Java String类的Split以竖线作为分隔符
- 学习Windows编程遇到的问题
- react native Unable to download JS bundle 的解决方案
- javascript的Object对象
- C++11 并发编程基础(一):并发、并行与C++多线程
- 移动端获取网络数据优化的几个点
- java工具(三)----jsp
- 微信公众平台java开发详解(工程代码+解析)
- android studio svn报错
- 从Android使用JSON传递参数到后台中文编码问题
- 内向、不善社交的人如何建立人脉?修
- 手把手教你Dojo入门
- Query Validate
- mysql 查看数据库文件存放地址语句