Has anybody found a good way to scroll to an element?
I can do something like the below function. But I am running into situation where a single swipeUp is too much swipe!! It looks like swipeUp is about 1.5 the size in view. So when I swipe up the element I am wanting goes out of view in the top.
Any ideas?
Thanks!
func swipeUpUntilElementFound(app: XCUIApplication, element : XCUIElement, maxNumberOfSwipes : UInt) -> Bool{
if element.exists{
return true
}
else {
for _ in 1...maxNumberOfSwipes{
app.swipeUp()
if element.exists{
return true
}
}
return false
}
}
You are not supposed to have to scroll manually. Interacting with an element that is not currently visible in the scroll view is expected to implicitly first scroll the element to be visible, without requiring effort on your part. If that's not working for you, please file a bug report (using the Report Bugs link at the bottom of this page). Thanks!