【发布时间】:2014-07-14 19:44:14
【问题描述】:
我在 Robot Framework 中编写 if 条件时遇到问题。
我要执行
Run Keyword If '${color}' == 'Red' OR '${color}' == 'Blue' OR '${color}' == 'Pink' Check the quantity
我可以在一个条件下使用这个“Run keyword If”关键字,但是对于多个条件,我得到了这个错误:
失败:关键字名称不能为空。
我也想使用这些关键字:
Run Keyword If '${color} == 'Blue' AND '${Size} == 'Small' AND '${Design}' != '${Simple}' Check the quantity
和
Run Keyword Unless '${color}' == 'Black' OR '${Size}' == 'Small' OR '${Design}' == 'Simple'
但我最终会遇到错误。
【问题讨论】:
-
由于您正在对条件进行 OR'ing,因此您可以只使用 3 个
Run Keyword If语句。 -
试试
Run Keyword If '${color}' in ['Red', 'Blue', 'Pink'] Check the quantity -
感谢您的回答。也可以帮我回答编辑的部分吗?谢谢!
标签: python python-2.7 selenium robotframework