I started using Xamarin UI Test for my Automated tests nearly 9 months ago. Recent updates to the UI of the app I'm working on made it so the elements behind Appbar and Navbar are considered displayed on the screen, which leads to a Tap on the Appbar/Navbar and not the actual element, I asked the devs on my team if there's anything they can do but they couldn't change that weird behaviour from those 2 elements. I've been looking for a way to scroll an element to the center/middle of the view but in vain. Does anyone know how I can accomplish this centred scroll? or a solution for this issue?
Here's the code I usually use :
app.ScrollDownTo(x=>x.Id("Element ID"));
I use Appcenter to run my tests on multiple devices, this is the method I use when I encounter this problem, I can make it work for one device but it probably does not work on other screen sizes :
//I scroll little by little until I find my element
for( int i = 0; app.Query(x=>x.Id("Element ID")).length == 0 && i<10; i++){
//this code performs a very small scroll gesture
app.ScrollDown(x=>x.ClassFull("UIScrollView"));
}
Thanks a lot for your help.