How to apply if else condition for SikuliLibrary with RobotFramework?

梦想与她 提交于 2019-12-12 10:29:09

问题


I'm using SikuliLibrary with RobotFramework for automating windows desktop application. One case is like: sometimes you need to put login credentials sometimes not, So I have to apply if else condition for SikuliLibrary with RobotFramework? I mean if login screen appear then will put credentials otherwise not. as it is image based So, I'm unable to apply if else condition.


回答1:


You could have the login executed unconditionally, in a Run Keyword And Ignore Error block, and continue if it (the login) wasn't present:

${rc}  ${msg}    Run Keyword And Ignore Error     Do Sikuli Login
Run Keyword If     "${rc}" == 'FAIL' and "${msg}" != 'the expected message when the login was not present'
...    Fail    The Login keyword failed unexpectedly: ${msg}

Naturally, this would be useful only if the login must/may happen at certain points in your scenarios, not on semi-random basis (it's not clear to me isn't it the latter from your question).

Disclaimer: I've never used RF with Sikuli, only each by itself - can be totally off the mark here.



来源:https://stackoverflow.com/questions/53543243/how-to-apply-if-else-condition-for-sikulilibrary-with-robotframework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!