如何使用 RobotFramework 为 SikuliLibrary 应用 if else 条件? [英] How to apply if else condition for SikuliLibrary with RobotFramework?

查看:77
本文介绍了如何使用 RobotFramework 为 SikuliLibrary 应用 if else 条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SikuliLibrary 和 RobotFramework 来自动化 Windows 桌面应用程序.一种情况是:有时您需要输入登录凭据,有时则不需要,所以我必须使用 RobotFramework 为 SikuliLibrary 应用 if else 条件?我的意思是,如果出现登录屏幕,则将输入凭据,否则不会.因为它是基于图像的所以,如果其他条件我无法申请.

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.

推荐答案

您可以在 Run Keyword And Ignore Error 块,如果它(登录名)不存在,则继续:

${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).

免责声明:我从未将 RF 与 Sikuli 一起使用,只有每个都单独使用 - 在这里完全不合时宜.

这篇关于如何使用 RobotFramework 为 SikuliLibrary 应用 if else 条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆