Forum Xamarin Test Cloud (Read Only)

ScrollDown\Up functionality

Hi, im relativly new to ui test so i hope this wont sound weird....

im trying to scroll down my app and some things just dont seems to work as expected...

in the working with gestures tutorial page, the description for scrollDown\Up methods state:

"UITest may only interact with views that are visible on the screen. It is possible to use IApp.ScrollUp or IApp.ScrollDown to programatically scroll the view onto the screen. This methods take an AppQuery or a Marked string to reference a specific view. UITest will then scroll until the view is visible on screen."

unfortunaly when i try to scroll a menu in my app to an invisible view i get an error stating the "unable to scroll no element found..."
the scrolling works once the view is visible on the screen. in that case, the method will not scroll to the view, but tap it....

i also tried to concat the all() method before the marked

this is the code i use:
app.ScrollDown(c => c.All().Text("Content_Automation"));

where the text in the view is ofcourse 'Content_Automation'

am i missing something? should the whole point of scroll would be to expose invisible elements to the screen? also why is the scroll method tapping my view?

thanks in advance

Best Answers


  • MathewTaylor.6972MathewTaylor.6972 USUniversity
    edited May 2016

    We have a form with many text fields where we would like to scroll to index x on the page. Some of the fields are off screen, and not visible.

    The following code will not scroll the iOS screen:-

    app.ScrollDownTo(c => c.All().Id("TextField").Index(3), c => c.Id("ScrollViewer"));

    Where as the following code does:-

    app.ScrollDownTo(c => c.Id("TextField").Index(3), c => c.Id("ScrollViewer"));

    So it seems that scroll functions do not like All() within the toQuery.

    Is this a bug, or by design?

    Thanks for your help

  • hey @MathewTaylor.6972 is there a difference in the output when you run these as a query?

    my guess is that you are scrolling a different ui element

  • MathewTaylor.6972MathewTaylor.6972 USUniversity

    No scrolling occurs. What is very interesting is, this works:-

    app.ScrollDownTo(c => c.Id("TextField").All().Index(3), c => c.Id("ScrollViewer"));

    I moved the All() towards the end of the query.

  • Hello, Tried below all option but none is working for me :neutral:
    //app.ScrollDownTo("bean 2",withinMarked: "discoverListView", strategy: ScrollStrategy.Auto , timeout: new TimeSpan(0, 1, 0));
    //app.ScrollUpTo(toMarked: "bean 2", withinMarked: "discoverListView");
    //app.ScrollDownTo("imgView", withinMarked: "discoverListView");
    //app.ScrollDownTo(x => x.Text("bean 2").Index(1));
    //app.ScrollDownTo(x => x.Id("bean 2").All().Index(3), x => x.Id("discoverListView"));
    app.ScrollTo("Sumatran from Sharon Pierce China", withinMarked:"discoverListView",strategy: ScrollStrategy.Auto, timeout: new TimeSpan(0, 1, 0));

    Getting system exception unable to scroll.....
    Am i doing anything wrong?

    Thanks in advance.

  • trebor74trebor74 USMember ✭✭

    I've ran into this today when doing Asserts, and in case it helps anyone else it appears specifying strategy: ScrollStrategy.Gesture ensures the control is found even it it is not currently visible on screen. Without this it defaults to Auto, and I was getting the element not found issue.

Sign In or Register to comment.