为什么下面的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 1\n$packets_time1: ${packets_1}\npackets_time2: ${packets_2}