python + unittest + HTMLTestRunner 执行suite用例报错

Traceback (most recent call last):
File "C:/ws/Selenium-Framework-master/testsuites/TestRunner.py", line 48, in <module>
runner.run(createsuite1())
File "C:\Python27\Lib\HTMLTestRunner.py", line 628, in run
test(result)
File "C:\Python27\Lib\unittest\suite.py", line 70, in __call__
return self.run(*args, **kwds)
File "C:\Python27\Lib\unittest\suite.py", line 100, in run
self._handleClassSetUp(test, result)
File "C:\Python27\Lib\unittest\suite.py", line 153, in _handleClassSetUp
self._addClassOrModuleLevelException(result, e, errorName)
File "C:\Python27\Lib\unittest\suite.py", line 198, in _addClassOrModuleLevelException
result.addError(error, sys.exc_info())
File "C:\Python27\Lib\HTMLTestRunner.py", line 584, in addError
output = self.complete_output()
File "C:\Python27\Lib\HTMLTestRunner.py", line 558, in complete_output
return self.outputBuffer.getvalue()
AttributeError: '_TestResult' object has no attribute 'outputBuffer'

  

百度搜索,不能解决问题,谷歌无法上网,只能想办法单独执行用例,报错:

Failure
Traceback (most recent call last):
File "C:\Python27\Lib\unittest\suite.py", line 146, in _handleClassSetUp
setUpClass()
File "C:\ws\Selenium-Framework-master\testsuites\test_baidu_search.py", line 16, in setUpClass
cls.driver = browse.open_browser(cls)
File "C:\ws\Selenium-Framework-master\framework\browser_engine.py", line 45, in open_browser
driver.maximize_window()
File "C:\Users\Administrator\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 728, in maximize_window
self.execute(command, {"windowHandle": "current"})
File "C:\Users\Administrator\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 314, in execute
self.error_handler.check_response(response)
File "C:\Users\Administrator\PycharmProjects\untitled\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=66.0.3359.181)
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64)

查找原来是chrome 浏览器和chromedriver 版本不一致

虽然我下载了和chrome浏览器一致的chromdriver,也放到c盘widows目录环境变量中去了,但是在代码中指定的chromedriver 位置中存放的还是旧版本。更换好对应版本的chromedriver后就好了

我有另外一篇博客介绍怎么获取正确的chromdirver版本 :http://www.cnblogs.com/testway/p/8041937.html

python执行selenium报错的更多相关文章

  1. Jenkins执行selenium报错unknown error: cannot find Chrome binary

    问题描述:在Pycharm中执行selenium测试用例,可以正常运行, 集成在Jenkins中,构建时,发现构建成功,但是查看Console Output,报错:unknown error: can ...

  2. 【Selenium】【BugList4】执行pip报错:Fatal error in launcher: Unable to create process using '""D:\Program Files\Python36\python.exe"" "D:\Program Files\Python36\Scripts\pip.exe" '

    环境信息: python版本:V3.6.4 安装路径:D:\Program Files\python36 环境变量PATH:D:\Program Files\Python36;D:\Program F ...

  3. selenium执行js报错

    selenium执行js报错 Traceback (most recent call last):    dr.execute_script(js)  File "C:\Python27\l ...

  4. Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError

    Django中修改DATABASES后,执行python manage.py ****报错!UnicodeEncodeError: 'latin-1' codec can't encode chara ...

  5. mac下python环境pip报错[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 的解决方法

    1.mac下python环境pip报错: issuserdeMacBook-Pro:~ issuser$ pip install pyinstallerCollecting pyinstaller  ...

  6. 执行mysqld_safe报错:mysqld does not exist or is not executable

    执行mysqld_safe报错: [root@edu data]# /usr/local/mysql5.7/bin/mysqld_safe --user=mysql160427 12:41:28 my ...

  7. 数据库执行sql报错Got a packet bigger than 'max_allowed_packet' bytes及重启mysql

    准备在mysql上使用数据库A,但mysql5经过重装后,上面的数据库已丢失,只得通过之前备份的A.sql重新生成数据库A. 1.执行sql报错 在执行A.sql的过程中,出现如下错误:Got a p ...

  8. mysql执行update报错1175解决方法

    mysql执行update报错 update library set status=true where 1=1 Error Code: 1175. You are using safe update ...

  9. 转 sqlplus执行sql报错:ORA-01756:

    1.sqlplus执行sql报错:ORA-01756: quoted string not properly terminated   分类: 技术         在SQLPLUS中执行SQL文件时 ...

随机推荐

  1. Payment相关逻辑

    payment相关逻辑 付款有手动付款和计划程序自动付款两种,照例先列出涉及到的概念 付款方式 - PaymentTypes - 现金,支票,信用卡,等等 记账类型 - Ledger_AccTrans ...

  2. JDBC编程之事务的使用教程

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/5868750.html  关于事务的理论知识.ACID特性等等,网上太多了,在此不一一重复.本文主要着重  事务 ...

  3. DDIA

    https://vonng.gitbooks.io/ddia-cn/content/ch7.html

  4. soapui configure before taking to develop code

    1,first go to the settings and configure as below:

  5. 删除sql server用户时报15138错误

    问题 在删除sql server中某数据库下的用户时报15138错误,见下图  解决 可用下述sql代码检查该用户的架构信息,然后逐一修正 SELECT s.name FROM sys.schemas ...

  6. python之模块ftplib(实现ftp上传下载代码)

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之模块ftplib(实现ftp上传下载代码) #需求:实现ftp上传下载代码(不含错误处理) f ...

  7. python实现的摩斯电码解码\编码器

    代码地址如下:http://www.demodashi.com/demo/14743.html 详细说明: 现在这年头谍战片.警匪片动不动就用摩斯密码来传递信息,一方面可以用来耍帅,另外一方面好像不插 ...

  8. PM_LOG

    /**查询所有网元的所有粒度**/ SELECT EMS_PM_LOG_ID, SUBNET_ID, AMOID, NE_TYPE, PO_ID, PO_TABLE, GP_BEGIN_TIME, L ...

  9. Delphi 7调用C语言编写的DLL

    DLL一定是要C语言导出的符号,也就是extern “C”. 当然,我们都知道DLL调用分为动态调用和静态调用. 动态调用的一般思想为,先LoadLibrary那个你想加载的DLL,然后通过GetPr ...

  10. 第十九章,指针小练习(C++)

    #include <iostream> int main(int argc, char** argv) { int i = 1; int *n ; n=&i;//*n=i 这样的赋 ...