【发布时间】:2018-06-24 17:45:48
【问题描述】:
有没有办法根据条件返回值
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
不确定这是否可以实现。如果不是,可能的方法是什么?
还有..如何做下面的动作..(即想要返回并打印一些消息)
Run Keyword if '${Is_Checkbox_Selected}'== 'True' Return True Log somemsg
【问题讨论】:
-
刚刚引起我注意的东西 -
Run keyword and return status返回一个真正的 pythonTrue/False- 一个布尔数据类型。因此,您不必比较它们的字符串表示形式,最好将其作为布尔值进行:Run Keyword if ${Is_Checkbox_Selected} -
是的,没错
标签: python robotframework