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. VS2012 No exports were found that match the constraint

    1:打开VS2012新建工程以及打开项目报一下错误提示 2:是由于.NET Framework 4.5 补丁造成的 从:https://www.microsoft.com/zh-CN/download ...

  2. JNI 数据类型转换

    一. 把java中的string 转化成 c中的char数组 /** *Jstring2CStr 把java中的string 转化成 c中的char数组. *jstring jstr 要被转化的jav ...

  3. django之创建第8-3个项目-数据库数据提取之高级操作

    1.配置test2.html <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  4. django之创建第6-1个项目-自定义过滤器

    1.在站点blog目录下创建templatetags文件夹 2.templatetags目录下需要作为一个包来处理和调用其中的内容,需要有一个__init__.py文件 3.在templatetags ...

  5. python之函数用法endswith()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法endswith() #http://www.runoob.com/python/at ...

  6. 什么样的路由器有类似改hosts的功能

    2011-7-22 23:06:45 如题 就是像电脑上改hosts那样把某个域名强制解析到指定IP上 TT,DD和openwrt有没有这样的功能? ------------------------- ...

  7. 获取客户机的ip和mac地址

    只获取clientIP package com.ppms.utils; import javax.servlet.http.HttpServletRequest; /** * Created by l ...

  8. SqlServer整库备份还原脚本

    最近领导要求定时备份数据库(不是我的作业), 搜了一下资料还不少, 先mark一下, 得空再验证吧!!! 以下内容为转载 转自:https://www.cnblogs.com/want990/p/74 ...

  9. keras中的模型保存和加载

    tensorflow中的模型常常是protobuf格式,这种格式既可以是二进制也可以是文本.keras模型保存和加载与tensorflow不同,keras中的模型保存和加载往往是保存成hdf5格式. ...

  10. C语言中的随意跳转

    C语言中有一个很不常用的头文件:setjmp.h. 这个头文件是C语言底层实现的,不像math.h里面的函数都是纯C语言实现的. setjmp.h包含两个函数: longjmp 跳转到某个位置 set ...