以下代码不起作用。
如果条件为真,我想设置一个变量。
Run Keyword If ${MAC} == 110299160221421 ${device_serial}= set variable ${device_serial_1}
我收到错误:
No keyword with name '=' found
这是有效的,但不会改变变量。
Run Keyword If ${MAC} == 110299160221421 Log to console 111
最佳答案
Run keyword if
返回您正在运行的关键字的结果。因此,与任何其他关键字一样,如果要保存值,请在第一列中放置一个变量:
${device_serial}= run keyword if ${MAC} == 110299160221421
... set variable ${device_serial_1}
在这个特定情况下,您可能想使用 Set Variable If而不是运行关键字如果
${device_serial}= set variable if ${MAC} == 110299160221421
... ${device_serial_1}
关于variables - "Run Keyword If"并设置一个变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35622902/