用python + selenium,pytest框架,生成的html报告中,中文显示乱码,如下图:

 

找到pytest-html 插件下的plugin.py(路径:/lib/python3.9/site-packages/pytest_html/plugin.py)做如下修改:

将  self.test_id = report.nodeid.encode("utf-8").decode("unicode_escape")

改为:self.test_id = report.nodeid

 

 

 中文显示乱码的问题就解决了。

posted on 2021-08-25 15:15  萧萧520  阅读(266)  评论(0)    收藏  举报