首页 > 解决方案 > 无法使用扩展 AppiumLibrary 的自定义机器人框架库单击元素

问题描述

我正在尝试Robot FrameworkPython.
我正在扩展AppiumLibrary并且我正在尝试编写一个函数,该函数countryGermany从活动中单击具有 id 的元素。
目前我收到一个错误:Element 'countryGermany' did not appear in 5 seconds. 我也尝试了id=countryGermany选择器,同样的错误。

我的代码如下所示:

from PageObject import PageObject

class Foo(PageObject):
def choose_country(self):
    self.open_application('http://localhost:4723/wd/hub', platformName='Android', deviceName='CB512A784E', appPackage='com.example.MyApplication', appActivity='.MainActivity')
    self.wait_until_page_contains_element('bar')
    return self.tap('bar')

我怎么能点击那个元素?

标签: pythonrobotframeworkpython-appium

解决方案


5 秒是一个非常短的超时时间,因为应用程序刚刚启动。


推荐阅读