Python Robot FrameWork::在关键字结束前返回一个值
是否有基于条件返回值的方法Python Robot FrameWork::在关键字结束前返回一个值,python,robotframework,Python,Robotframework,是否有基于条件返回值的方法 Obtain The Status Of CheckBox [Arguments] ${item} ${Is_Checkbox_Selected}= Run Keyword And Return Status Checkbox Should Be Selected //*[@id="ctl00_PageBody_RolesList"]/tbody/tr/td/label[normalize-space(text())='${i
Obtain The Status Of CheckBox
[Arguments] ${item}
${Is_Checkbox_Selected}= Run Keyword And Return Status Checkbox Should Be Selected //*[@id="ctl00_PageBody_RolesList"]/tbody/tr/td/label[normalize-space(text())='${item}']/preceding-sibling::input
Run Keyword if '${Is_Checkbox_Selected}'== 'True' Return True #Todo: how to do more than one action here
... Else Return False
不确定这是否可以实现。如果没有,可能的方法是什么
还有。。如何执行以下操作…(即,希望返回并打印一些消息)
如果“${Is_Checkbox_Selected}”,则运行关键字=='True'返回True Log somemsg在关键字结尾之前返回值的关键字是
从关键字返回;还有一个简写条件变量从关键字If返回(这两个关键字都是在Robot Framework 2.8-)中引入的)
要记录消息,然后返回,请使用运行关键字
链接这两个命令:
Run Keyword if '${Is_Checkbox_Selected}'== 'True' Run Keywords Log somemsg AND Return From Keyword True
... ELSE Return From Keyword False
请注意大小写-ELSE和and必须是大写字母,框架才能将它们选作保留关键字。刚刚引起我注意的内容-Run关键字和returnstatus
返回一个真正的pythonTrue
/False
-一个布尔数据类型。因此,您不必比较它们的字符串表示形式,最好使用布尔值:Run关键字if${Is_Checkbox_Selected}
是的,这是正确的