I am working on an Android application. I have created a test script that has a step ‘swipe to element’.
Whenever I run this script I am getting different results. It is finding the expected element on the screen that is what I want.
Problem statement - It is scrolling on the screen to find an element but the position of the element is always different on the screen. Sometimes element is found at the bottom of the screen, sometimes its found at the middle of the screen and sometimes its found at the top of the screen.
In screenshots you can see that the position of ‘New Albums’ text is different when I run the script.
I want this element to be displayed on the middle of the screen.
Step - Swipe DOWN to find element. Xpath = ‘//android.view.View[@content-desc = ‘New Albums’]’