我有在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
未知地区 1F
使用它:
context.driver.find_element_by_android_uiautomator(‘new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("List Y27").instance(0));’)