为什么以下Robot语句抱怨"Convert To Integer"关键字是无效语法?感谢
Run Keyword If Convert To Integer ${packets_2} <= Convert To Integer ${packets_1}
... FAIL ${n}[FAILED] Packets 2 not greater than packets 1.
... ${n}packets_time1: ${packets_1} ${n}packets_time2: ${packets_2}
不能调用关键字作为Run Keyword If
的条件。第一个参数应该是python表达式。由于您试图对一个整数进行比较,因此可以直接在表达式中这样做:
Run keyword if int('${packets_2}') <= int('${packets_1})
... FAIL n[FAILED] Packets 2 not greater than packets 1
另一个问题是您提供了另外两个参数:${n}packets_time1: ${packets_1}
和${n}packets_time2: ${packets_2}
。目前还不清楚你认为这些是为了什么。我猜您希望将它们作为错误消息的一部分。如果是这样的话,它必须全部在一行上,否则机器人会认为它们是FAIL关键字的额外参数。
Run keyword if int('${packets_2}') <= int('${packets_1})
... FAIL n[FAILED] Packets 2 not greater than packets 1n$packets_time1: ${packets_1}npackets_time2: ${packets_2}