I would like to add a click script to my generic button which scrolls the page view down to the next field.
I found the following function in API Methods, but don't know how to use it, as there is no example provided:
Scroll.scrollTo(target, focus, percentage)
What are the parameters, and their possible values, and what effect do different values have?
You can view the parameters and their possible values and a brief description about what the method does by clicking the "Show Details" button
Scroll.scrollTo("textField", true, 50)
This will scroll to a textField and focus in on it, if false it won't focus. The next option parameter 50 will ensure it will scroll to the middle of the page 50%. You can make this 0 to 100 for percentage.
I think the Maestro documentation could be improved by giving more detail about each parameter in the API docs. For example, in this case it would be helpful if the docs stated that the second parameter was a boolean.
+1, like, upvote.
Note that it is vitally important that the first argument is the item id, not the data path.
In other words:
Scroll.scrollTo("givenNames", false, 0) // is correct
Scroll.scrollTo("data.givenNames", false, 0) // is incorrect
In Maestro 5.0.20 +
Item data path strings will be accepted as the first parameter.
is it possible to override the default scroll behavior for page navigation?
At the moment the default behavior on page change is to scroll to the top of the content, however we would like to scroll so that the navigation chevrons are visible.
Is this a setting, or do we need to implement the Scroll.scrollTo() function?
How do I trigger the scroll function on page change?