简体   繁体   English

如何在 Robot Framework 中设置带有特殊字符的变量

[英]How to set variable with special characters in Robot Framework

I am setting a variable with String which has some special characters.我正在使用具有一些特殊字符的 String 设置一个变量。

Here's below the code snippet for the same下面是相同的代码片段

${message} Set variable < & Hi, how can I help? > " '

Also the same message is being sent in logs and it is being validated using the grep command.同样的消息也在日志中发送,并且正在使用 grep 命令进行验证。 But I'm facing issue while validating the same.但是我在验证相同内容时遇到了问题。 I tried escaping few characters in set variable.我在设置变量中尝试了 escaping 几个字符。 Also tried to match the number of double quotes and single quote.还尝试匹配双引号和单引号的数量。 But no help但没有帮助

You can try this syntax ${escaped} = Regexp Escape ${original}你可以试试这个语法 ${escaped} = Regexp Escape ${original}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM