能够点击按钮但是我的原生Android应用程序中没有加载下一页

时间:2015-06-09 10:24:22

标签: android python-2.7 selenium-webdriver uiautomator android-uiautomator

我正在尝试在我的Android平板电脑中自动化原生应用程序。在该应用程序中,我需要填写帐单地址,然后单击继续按钮转到下一张信用卡详细信息。

这里我面临两个问题: 1.当我手动填写详细信息时,自动启用继续按钮。但是通过自动化继续按钮未启用,并且没有返回任何错误。

2.通过自动化而不填写任何细节,然后按下继续按钮启用,但点击继续按钮后没有任何事情发生。

以下是我的代码。

self.d(text='Name on Card').set_text('App Test');`
self.d.press('down');
self.d(text='City').set_text('Madison');
self.d.press('down');
self.d(className="android.widget.ListView").child_by_text("Delaware",allow_scroll_search=True,className="android.widget.TextView").set_text('Delaware')
#now continue button has to be enabled automatically..but which is not happening 
self.d.press('down');
self.d(text='Continue').click()

可能是我不知道有些JavaScript功能在后台运行。我们怎么知道原因并继续前进?需要一些帮助。

顺便说一句,我使用的是selenium-webdriver,python,uiautomator python包装器。

1 个答案:

答案 0 :(得分:1)

最后我得到了解决方案。通过使用UIAUTOMATOR的python包装器,我可以继续下一页。我使用down方法直到选项可见,然后按Enter键接受它而不是单击方法。 以下是代码。

while(self.d(resourceId="android:id/text1").text!='Hawaii'):
        self.d.press('down');
self.d.press('enter')