Robot Framework:如何使用 ascii 编码字符串?

Robot Framework: how to encode string using ascii?

我有一个关键词:

Verify Payment Method Field
Element Text Should Be    ${paymentMethodValueField}     PDF-lasku sähköpostiin

这是日志:

Step 3 Fields verification :: OK: Display Customer Information fie... | FAIL |
The text of element '//div/span' should have been 'PDF-lasku s?hk?postiin' but in fact it was 'PDF-lasku s?hk?postiin'.

我需要写这样的东西,但我不知道怎么写:

 PDF-lasku s[ascii symbol]hk[ascii symbol]postiin

有人可以帮我吗?

我可能会把整个东西转换成一种或另一种格式,然后评估?或者 ASCII 字符位于字符串的某些部分是否重要?如果不是,而您只是想验证返回的内容是否正是您所期望的,为了简单起见,我可能会使用 Encode String to Bytes,如果 ASCII 很重要,甚至 encoding/decoding 关键字也可以满足您的需求。

http://robotframework.org/robotframework/latest/libraries/String.html#Encode%20String%20To%20Bytes

通过使用上面的方法,您可以将其设置为忽略无法转换的字符或将其替换为您提供的已知字符。只需先获取文本,然后执行您想要的任何操作并进行评估。

如果 ASCII 位置很重要,关于 decoding/encoding 的备选方案是:

http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Convert%20To%20Bytes