10 Replies
      Latest reply on Jul 30, 2018 3:29 AM by johnmabassa
      mos6y Level 1 Level 1 (0 points)

        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
                }
            }