[英]Robot FrameWork:: Return a Value before Keyword ends
有没有办法根据条件返回值
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
要在关键字结尾之前返回值的关键字是Return From Keyword
; 还有一个简写的条件变体Return From Keyword If
(这两个关键字都在Robot Framework 2.8- 文档中引入)。
要记录一条消息,然后返回,请使用Run Keywords
将两个命令链接起来:
Run Keyword if '${Is_Checkbox_Selected}'== 'True' Run Keywords Log somemsg AND Return From Keyword True
... ELSE Return From Keyword False
请注意大小写-ELSE和AND都必须使用大写字母,以便框架选择它们作为保留关键字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.