Robot framework log.html文件显示字符串中的特殊字符。
关键字:
Log ${result} console=yes level=INFO
log.html输出:
'\r\r\nServer listening on UDP port 9004\r\r\nReceiving 1470 byte datagrams\r\r\nUDP buffer size: 160 KByte (default)\r\r\n------------------------------------------------------------\r\r\n[ 4] local 192.168.200.190 port 9004 connected with 10.42.12.2 port 47325\r\r\n[ ID] Interval
当我使用Log To Console关键字时,它会将相同的字符串记录到控制台,如下所示:
Server listening on UDP port 9004
Receiving 1470 byte datagrams
UDP buffer size: 160 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.200.190 port 9004 connected with 10.42.12.2 port 47325
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 4] 0.0- 4.0 sec 46.8 MBytes 98.1 Mbits/sec 0.128 ms 227/33602 (0.68%)
如何在log.html文件中以与没有特殊字符的控制台相同的格式显示此字符串' \ n'和' \ r'?
答案 0 :(得分:0)
解决方案是用br标签替换所有\ n,并在Log关键字中启用html选项。
${resultDL} String.Replace String ${result} \n <br>
${resultDL} String.Remove String ${resultDL} \r
Log ${resultDL} html=yes level=INFO