TestProject Forum
Powered by leading experts in the test automation community

Test fail to find Element across different Android versions

Hi,

I have an application developed using React-Native. I created a Release build and uploaded the APK to TestProject, recorded a test using a Device with Android 10 API 29 and then tried to run the same test with the same APK on a device with Android 8 API 26.

The test fail because it can’t find the Element that matches the XPATH. Using the element finder I could compare the expected XPATH and the one on the app running on the Android 8 API 26 device. One of the wrappers gets a different index.

Element in test recorded on Android 10 API 29:
//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[3]/androidx.drawerlayout.widget.DrawerLayout[1]/android.widget.RelativeLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.ScrollView[1]/android.view.ViewGroup[1]/android.view.ViewGroup[2]/android.widget.EditText[1]

Same Element in the device Android 8 API 26:
//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/androidx.drawerlayout.widget.DrawerLayout[1]/android.widget.RelativeLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.ScrollView[1]/android.view.ViewGroup[1]/android.view.ViewGroup[2]/android.widget.EditText[1]

Why would the XPATH change for the same APK across different Android versions? Has anyone else encountered this issue?