【问题标题】:Robot Framework with Appium Library: take actions depending on current Page带有 Appium 库的机器人框架:根据当前页面采取行动
【发布时间】:2022-01-04 12:46:38
【问题描述】:

我的机器人框架测试正在测试一个执行蓝牙功能的移动应用。蓝牙的东西不是很稳定。

因此,我想在失败之前引入一些重试。我知道这件事:

Wait Until Keyword Succeeds    5x    10s    Keyword

问题是这样的:根据上一个蓝牙命令的成功或失败(或者如果是第一次尝试),应用程序在不同的页面中。

为了解决这个问题,我想开始尝试蓝牙命令:

  1. 查看我们是否在正确的页面上
  2. 如果没有,请按回

阅读Appium Library for Robot Framework 的文档,我只找到了Page Should * Contain 关键字。如果页面不正确,这些失败测试。我不想失败,我想采取行动。

我该怎么做?

Run Keyword If
...    Page Does Not Contain Text     ${my_page_text}
...    Click Back
Page Should Contain    ${my_page_text}

【问题讨论】:

    标签: robotframework


    【解决方案1】:

    我们使用的技术是通过使用Run Keyword and Return StatusRun Keyword and Ignore Error 来避免关键字失败。

    类似:

    ${text_OK}=    Run Keyword and Return Status    Page Should Contain    ${my_page_text}
    Run Keyword If    not ${text_OK}    Click Back
    

    【讨论】:

      猜你喜欢
      • 2019-02-18
      • 2021-04-08
      • 2016-04-26
      • 1970-01-01
      • 2019-11-21
      • 2018-08-21
      • 2020-03-29
      • 2015-06-15
      • 2014-09-15
      相关资源
      最近更新 更多