gpt4 book ai didi

python - 机器人框架: how to encode string using ascii?

转载 作者:太空宇宙 更新时间:2023-11-03 16:47:51 26 4
gpt4 key购买 nike

我有一个关键字:

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 字符位于字符串的某些部分是否重要?如果不是,并且您只是想验证返回的内容是否正是您所期望的,为了简单起见,我可能会使用将字符串编码为字节,如果 ASCII 很重要,甚至编码/解码关键字也可能满足您的需求。

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

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

如果 ASCII 位置很重要,则有关解码/编码的替代方案是:

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

关于python - 机器人框架: how to encode string using ascii?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36152566/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com