在学习python selenium自动化测试学习中遇到HTMLTestRunner测试报告出现乱码的问题

Test Group/Test case Count Pass Fail Error View
baidu.Baidu 1 1 0 0 Detail
test_baidu_search: 百度搜索
pass

pt1.1: [Error 32] : 'c:\\users\\zhengb~1\\appdata\\local\\temp\\tmpmoado1\\AddonInstaller\\log.txt'

login_Verification.OA 2 2 0 0 Detail
test_login: 登录验证
pass

pt2.1: 君玲思登录成功!
[Error 32] : 'c:\\users\\zhengb~1\\appdata\\local\\temp\\tmpbcuhbi\\AddonInstaller\\log.txt'

网上查找到HTMLTestRunner测试报告中文乱码的解决方案:

(1)打开HTMLTestRunner.py源文件,找到如下行

# o and e should be byte string because they are collected from stdout and stderr?
if isinstance(o,str):
# TODO: some problem with 'string_escape': it escape \n and mess up formating
# uo = unicode(o.encode('string_escape'))
uo = o.decode('latin-1')
else:
uo = o
if isinstance(e,str):
# TODO: some problem with 'string_escape': it escape \n and mess up formating
# ue = unicode(e.encode('string_escape'))
ue = e.decode('latin-1')
else:
ue = e

(2)添加utf-8的解码

# o and e should be byte string because they are collected from stdout and stderr?
if isinstance(o,str):
# TODO: some problem with 'string_escape': it escape \n and mess up formating
# uo = unicode(o.encode('string_escape'))
#uo = o.decode('latin-1')
uo = o.decode('utf-8')
else:
uo = o
if isinstance(e,str):
# TODO: some problem with 'string_escape': it escape \n and mess up formating
# ue = unicode(e.encode('string_escape'))
#ue = e.decode('latin-1')
ue = e.decode('utf-8')
else:
ue = e

HTMLTestRunner测试报告中文乱码问题解决的更多相关文章

  1. 【python-HTMLTestRunner】HTMLTestRunner测试报告中文乱码问题解决

    打开HTMLTestRunner.改动如图所示行 改成‘utf-8’

  2. python测试报告输出 htmltestrunner 及 中文乱码的解决方式

    下载HTMLTestRunner.py 第三方库 下载地址: python2:http://tungwaiyip.info/software/HTMLTestRunner.html 右键另存为下载HT ...

  3. WingIDE中文乱码问题解决方法

    WingIDE中文乱码问题解决方法 安装完WingIDE后,首次运行python脚本时,若脚本中含有UTF-8中文,在Debug I/O输出框中,全部变成了乱码. 这时其实我们设置下WingIDE的编 ...

  4. ubuntu mysql emma中文乱码问题解决

    ubuntu mysql emma中文乱码问题解决 emma默认用apt-get 安装的话,emma是不支持中文的,配置文件或直接修改emma程序源文件(python). apt-get安装emma ...

  5. Spring MVC3返回JSON数据中文乱码问题解决(转)

    Spring MVC3返回JSON数据中文乱码问题解决 查了下网上的一些资料,感觉比较复杂,这里,我这几使用两种很简单的办法解决了中文乱码问题. Spring版本:3.2.2.RELEASE Jack ...

  6. Ubuntu下Eclipse中文乱码问题解决(转)

    Ubuntu下Eclipse中文乱码问题解决 把Windows下的工程导入到了Linux下Eclipse中,由于以前的工程代码,都是GBK编码的(Windows下的Eclipse 默认会去读取系统的编 ...

  7. 【转】asp.net Cookie值中文乱码问题解决方法

    来源:脚本之家.百度空间.网易博客 http://www.jb51.net/article/34055.htm http://hi.baidu.com/honfei http://tianminqia ...

  8. soapUI参数中文乱码问题解决方法 (groovy脚本中文乱码)

    soapUI参数中文乱码问题解决方法 可能方案1: 字体不支持中文,将字体修改即可: file-preferences-editor settings-select font 修改字体,改成能显示中文 ...

  9. oracle中文乱码问题解决

    中文乱码问题解决:1.查看服务器端编码select userenv('language') from dual;我实际查到的结果为:AMERICAN_AMERICA.ZHS16GBK2.执行语句 se ...

随机推荐

  1. 自学Python全栈开发第一次笔记

           我已经跟着视频自学好几天Python全栈开发了,今天决定听老师的,开始写blog,听说大神都回来写blog来记录自己的成长. 我特别认真的跟着这个视频来学习,(他们开课前的保证书,我也写 ...

  2. loadrunner录制脚本(一) ----录制脚本打不开浏览器

    loadrunner安装参考百度上的,或者有已经准备好的安装文档. 安装好了之后,用 HP Virtual Generator 录制脚本. 在上述操作中,需要选择火狐浏览器的exe文件驱动.也可以选择 ...

  3. dynamic programming 学习

    这是看到一位大神,写的关于dynamic programming的博客,认为很好.简单分析下.然后给出链接. 背景问题就是 有一个国家,全部的国民都很老实憨厚,某天他们在自己的国家发现了十座金矿.而且 ...

  4. linux进程标识符具体解释1

    每一个进程都有一个实际用户标识符和一个实际组标识符,它们永远是启动该进程之用户的用户标识符和组标识符. 进程的有效用户标识符和有效组标识符或许更重要些,它们被用来确定一个用户是否能訪问某个确定的文件. ...

  5. keeplived日志位置指定

    作为一个运维DBA,除了关心数据库的关键指数.还得往架构和底层基础知识多靠拢. 2010年刚工作的时候,那会Cacti监控比較流行吧.可恶的是SNMP会把默认日志写到系统日志文件中面,导致排错时非常受 ...

  6. Scheme -- Hierarchical Structures

    Question: produce a deep-reverse procedure that takes a list as argument  and returns as its value t ...

  7. MyBatis_多查询条件问题

    一.多查询条件无法整体接收问题的解决 在实际工作中,表单中所给出的查询条件有时是无法将其封装成一个对象,即查询方法只能携带多个参数,而不能携带将这多个参数进行封装的一个对象.对于这个问题,有两种解决方 ...

  8. javascript 面向对象设计之 Function 普通类

    var test = "Class01"; function Class01(privateValue, publicValue) { var _this = this; if ( ...

  9. Springboot 之 解决IDEA读取properties配置文件的中文乱码问题

    问题描述 当在.properties的配置文件中有中文时,读取出来的总是乱码.比如我的application.properties配置文件的内容如下: server.port=9090 test.ms ...

  10. list对象数组,xpath复杂定位校验,POST入参为number数组,POST入参为JSON对象数组

    list对象数组: POST入参为number数组: {    "typeIds":[1,2,3]} POST入参为JSON对象数组,举例: [{    "itemId& ...