在学习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. node.js之第一天

    一.http模块 //require表示引包,引包就是引用自己的一个特殊功能 var http = require("http"); //创建服务器,参数是一个回调函数,表示如果有 ...

  2. Cesium中Clock控件及时间序列瓦片动态加载

    前言 前面已经写了两篇博客介绍Cesium,一篇整体上简单介绍了Cesium如何上手,还有一篇介绍了如何将Cesium与分布式地理信息处理框架Geotrellis相结合.Cesium的强大之处也在于其 ...

  3. springmvc关于前台日期作为实体类对象参数类型转换错误

    页面报错: 后台错误: Field error in object 'user' on field 'birthday': rejected value [2013-06-24]; codes [ty ...

  4. Python爬虫(十四)_BeautifulSoup4 解析器

    CSS选择器:BeautifulSoup4 和lxml一样,Beautiful Soup也是一个HTML/XML的解析器,主要的功能也是如何解析和提取HTML/XML数据. lxml只会局部遍历,而B ...

  5. nginx防恶意域名解析

    今天无意间查看访问日志发现一个fhxywh.com的域名居然解析到了我的服务器,也就是说通过这个域名也能访问我的博客,这个就是赤裸裸的恶意域名解析了. 这个危害非常大,不仅会影响用户,而且不利于SEO ...

  6. NHibernate3剖析:Configuration篇之SessionFactory lambda配置

    概览 在NHibernate3.0中.SessionFactory的Properties和Cache配置实现了流配置(fluent-configuration)和lambda表达式配置(lambda- ...

  7. 解决 ASP.NET Core MySql varchar 字符串截取(长度 255)

    ASP.NET Core 中使用 MySql,如果字段类型为varchar,不管设置多少长度,插入或更新数据的时候,会自动截断(截取 255 长度的字符). 出现问题的原因,就是使用了MySql.Da ...

  8. 自学Zabbix3.10.1.5-事件通知Notifications upon events-媒介类型自定义脚本

    自学Zabbix3.10.1.5-事件通知Notifications upon events-媒介类型自定义脚本

  9. check the manual that corresponds to your MySQL server version for the right syntax处理方案

    check the manual that corresponds to your MySQL server version for the right syntax:代码出现这样的bug,就要注意你 ...

  10. 多表连接时USING和ON的区别,USING会去掉重复列,ON显示重复列。