当我运行此代码时,它显示${month}
未找到且${month status}
正在返回True
:
${month status}= Run Keyword and Return Status Element Should Be Visible xpath=//div[@data-title='Cost for Month']
Run Keyword If '${month status}' == 'True'
... ${month}= Get Text xpath=//div[@data-title='Cost for Month']
... Log Dashboard is displaying ${month} Cost Usage for month Text
... ELSE
... Fail Cost Dashboard is not displaying Cost Usage for month Text
答案 0 :(得分:0)
${month status}= Run Keyword and Return Status Element Should Be Visible xpath=//div[@data-title='Cost for Month']
${month}= Run Keyword If '${month status}' == 'True' Get Text xpath=//div[@data-title='Cost for Month']
Run Keyword If '${month status}' == 'True' Log Dashboard is displaying ${month} Cost Usage for month Text
Run Keyword If '${month status}' == 'False' Fail Cost Dashboard is not displaying Cost Usage for month Text
有点粗略的解决方案,但我们也遇到了这种情况,并使用上面的修复程序解决了它。
我认为您的代码失败了,因为${month}
被解释为关键字而不是变量。