【发布时间】:2019-10-21 01:15:21
【问题描述】:
我从列表中选择一个随机值来对其执行一些操作,例如 Run Keyword If、Exit For Loop If、单击元素、等到页面包含所有内容。现在,在满足条件后我无法退出 for 循环,但发生的情况是从为值 Batman 设置的开始条件开始。
已经尝试过 :break & Exit For Loop 关键字,但对我没有用
@{Hero} Batman Superman Ironman
View All Details of Superhero
${value} = Evaluate random.choice($Hero) random
input text ${SEARCH_BAR} ${value}
log to console \nvalue: ${value}
click element ${SEARCH_BUTTON}
Run Keyword If '${value}' == 'Batman' click element ${P1}
... ELSE IF '${value}' == 'Superman' click element ${P2}
... ELSE IF '${value}' == 'Ironman' click element ${P3}
... ELSE log to console condition didn't met
:For ${value} IN @{Hero}
\ Log ${value}
\ Run Keyword If '${value}' == 'Batman' sleep 5s
\ EXIT FOR LOOP IF '${value}' == 'Batman'
\ click element //*[@href='#external']
\ click element ${BASIC_INFO}
\ wait until page contains Summary
\ click element ${RELATIONSHIP}
@{expected_relationship_result} create list Catwoman Robin
list should contain value @{expected_relationship_result}
\ Log condition didn't met
\ Run Keyword If '${value}' == 'Superman' click element
\ click element //*[@href='#external']
\ click element ${BASIC_INFO}
\ wait until page contains Summary
\ click element ${RELATIONSHIP}
@{expected_relationship_result} create list Wonderwomen Lois Lane
list should contain value @{expected_relationship_result}
\ Log condition didn't met
\ Run Keyword If '${value}' == 'Ironman' sleep 5s
\ EXIT FOR LOOP IF '${value}' == 'Ironman'
\ click element //*[@href='#external']
\ click element ${BASIC_INFO}
\ wait until page contains Summary
\ click element ${RELATIONSHIP}
@{expected_relationship_result} create list Wonderwomen Lois Lane
list should contain value @{expected_relationship_result}
\ Log condition didn't met
I'm not able to figure out when the condition is already been met then why Exit For Loop If is not working.
【问题讨论】:
-
'\' 从机器人 3.2 开始折旧
-
你能添加控制台输出正在发生的事情吗?
标签: robotframework