如何创建自动测试滚动列表,直到元素出现在视图中

Stacey丶梦菡 测试交流1 109字数 804阅读模式
摘要我有在python中使用behave framework进行自动化测试的研究案例,我必须在滚动视图android中找到列表中的元素。 对于示例列表:列表A1、列表A2、列表A3、列...

我有在python中使用behave framework进行自动化测试的研究案例,我必须在滚动视图android中找到列表中的元素。
对于示例列表: , 列表A2, 列表A3, 列表B1, 列表B2, ......., . 我一定在列表中找到了一个元素 在滚动页面上使用自动测试,直到该元素在视图中,并且自动滚动将在找到该元素后停止。对于之前滚动手册中的代码自动化示例,我使用以下代码:

@when('I want to buy again') #This is for condition in test case.
def toMyPurchase(context): #Context
    isPresent(context, MobileBy.XPATH, my_purchase_locator.SCROLL_VIEW_XPATH) #This is to find path and allocator element ID scroll view page.
    context.driver.swipe(474, 1636, 527, 392, 1000) #This is for scroll coordinate.
    time.sleep(0.5) #This is for time interval in scroll.
    isPresent(context, MobileBy.XPATH, my_purchase_locator.SCROLL_VIEW_XPATH)
    context.driver.swipe(474, 1636, 527, 392, 1000)
    time.sleep(0.5)
    isPresent(context, MobileBy.XPATH, my_purchase_locator.SCROLL_VIEW_XPATH)
    context.driver.swipe(474, 1636, 527, 1445, 1000)
    time.sleep(0.5)

任何人都可以给我python behave中的示例代码来解决这个研究案例。文章源自玩技e族-https://www.playezu.com/180099.html 文章源自玩技e族-https://www.playezu.com/180099.html

玩技站长微信
添加好友自动发送入群邀请
weinxin
rainbow-shownow
玩技官方公众号
官方微信公众号
weinxin
PLAYEZU
 
  • 版权提示:本站仅供存储任何法律责任由作者承担▷诈骗举报◁▷新闻不符◁▷我要投稿◁
    风险通知:非原创文章均为网络投稿真实性无法判断,侵权联系2523030730
    免责声明:内容来自用户上传发布或新闻客户端自媒体,切勿!切勿!切勿!添加联系方式以免受骗。
  • 原创转载:https://www.playezu.com/180099.html
    转载说明: 点我前往阅读>>>
    • Defandi
      Defandi 9

      使用它:
      context.driver.find_element_by_android_uiautomator(‘new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("List Y27").instance(0));’)

    匿名

    发表评论

    匿名网友
    确定