Error obtaining UI hierarchy

While running my automation script it is getting failed in one page and at the end of execution Appium is pressing home button. While debugging the issue i have followed the below procedure to verify whether my xpath is correct or not:

  1. Pressed the app killer button and selected my desired app.
  2. Open the UI automator to take the device screenshot.
  3. Click on Devicescreenshot icon and the below error message is displayed.

Then I have killed the app and navigated to the same page where i have got the issue and then clicked on Device Screenshot icon and was able to take the screenshot properly.

I have verified the xpath and all of them are correct.

UI Automator will throw this error when ur trying to capture screenshot while the Appium session is active. You need to stop your appium session and then capture the screenshot.

1 Like

@connecttokc I can understand that I am getting error from UI Automator while my appium session is active. But why my automation script is getting failed. I have double checked the xapth and explicit wait condition and all of them are fine.

TO continue the solution from connecttokc, Check if node is still running even after you kill your automation script. sometimes I have to kill it manually

You can watch this video : https://youtu.be/rONRIAsc2hg