Reputation: 427
I wonder what is the different between UI Automator
and driver.swipe
when I try to find element(s) with scroll.
With UI Automator
I can scroll and find element\elements
with text\text contains\id\text starts with
:
new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("' + text + '").instance(0))')
And with driver.swipe
is with x
and y
Upvotes: 0
Views: 921
Reputation: 3658
The different is in implementation and purpose:
UIAutomator
scrollable=true
attributeMobileElement firstClickableEl = driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().clickable(true)"))
MobileElement elementInView = driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("' + text + '").instance(0))')
"))
More information
Actions API
Actions API is used for different gestures like touch, tap, drag&drop, swipe, etc.
TouchAction swipe = new TouchAction(driver)
.press(element(images.get(2),-10, center.y - location.y))
.waitAction(waitOptions(ofSeconds(2)))
.moveTo(element(gallery,10,center.y - location.y))
.release();
swipe.perform();
More information
Upvotes: 1