如何在 RIDE 上通过两个图像在带有 SikuliLibrary 的 `RobotFramework` 中应用 If, Else 条件?

How to apply If, Else condition in `RobotFramework` with `SikuliLibrary` by two image on RIDE?

示例:点击应用程序图标后会出现登录屏幕(login_screen.png),有时会弹出一个OK对话框(ok_btn_dialog.png)登录屏幕,如果出现确定对话框我想点击确定按钮(ok_btn_dialog.png)然后继续登录屏幕(login_screen.png),否则将从登录屏幕继续(login_screen.png).

如何在 RobotFrameworkSikuliLibrary 中应用 If, Else 条件?通过在 RIDE 上使用这两个图像。

此处有一个答案,但不完全是 answer 我的问题。

有一个Existskeyword that will tell you if an image exists on screen. This results in a true/false response that can be used by the Run Keyword If keyword

*** Settings ***
Library    SikuliLibrary

*** Test Cases ***
TC
    ${exists}    Exists    ./some_image.png
    Run Keyword If    "${exists}"=="true"    Run True Keyword
    ...    ELSE IF    "${exists}"=="false"   Run False Keyword
    ...    ELSE                              Run Error Keyword   

这可以作为一个单独的关键字实现,如果存在则点击图像,否则忽略。

*** Settings ***
Library    SikuliLibrary

*** Test Cases ***
TC
    # Check if button exist and retry for 2 seconds returning false.
    Click If Exists    ./ok_btn_dialog.png    
    Click             ./login_screen.png

*** Keywords ***
Click If Exists
    [Arguments]    ${image}    ${timeout}=[=11=]
    ${exists}    Exists    ${image}    ${timeout}
    Run Keyword If    "${exists}"=="true"    Click  ${image}