在学习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. System.Security.Cryptography.RSA.FromXmlString 系统找不到指定的文件和X509读取证书文件系统找不到指定的文件异常

    前言: 最近公司增加服务器,在新增加的服务器中发现一些问题. 1.应用程序在读取证书文件中出现"系统找不到指定的文件."异常,但是已经确认证书文件存在.本地测试也可以读取,就在新增 ...

  2. 网页设计——5.table布局

    今天做一个大的页面,主要是对table布局的理解: 代码: <table cellspacing=0 border=1 style="bordercolor:#C0C0C0;" ...

  3. GDAL编译

    使用cmd命令行编译 1.首先在“开始菜单\所有程序\Microsoft Visual Studio 2008\Visual Studio Tools\ Visual Studio 2008命令提示” ...

  4. java学习笔记—集合之Map集合

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: center; font: 12.0px Times } p.p2 { margin: 0.0p ...

  5. es6+require混合开发,兼容es6 module,import,export

    近一年,一直很忙,做了不少的项目,不过都不是太满意,毕竟是别人的作品,不好意思写出来.最近打算开发一个es6的项目,项目中用到require,本文主要讲解es6的module规范怎么与require的 ...

  6. Codeforces Round #257 (Div. 2) A. Jzzhu and Children(简单题)

    题目链接:http://codeforces.com/problemset/problem/450/A ------------------------------------------------ ...

  7. [hdu 4869](14年多校I题)Turn the pokers 找规律+拓欧逆元

    Turn the pokers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. Spring定时任务有时候会莫名奇妙的终止?

    最近在是使用Spring配置定时定时任务(基于xml配置使用spring自带的定时任务),一开始使用没什么问题当使用久了就会出现有些定时任务自动停止了.(关于如何使用以及如何它的原理是啥,这里不进行阐 ...

  9. jsp的标签库和自定义标签

    1.jstl标签库 JSP标准标签库(JSTL)是一个JSP标签集合,它封装了JSP应用的通用核心功能. JSTL支持通用的.结构化的任务,比如迭代,条件判断,XML文档操作,国际化标签,SQL标签. ...

  10. java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfDiv.setKeepTogether(Z)V

    用com.itextpdf.text.Document打印pdf报错 时间:2017-06-22 12:23:39,594 - 级别:[ERROR] - 消息: [other] Servlet.ser ...