Search code examples
androidseleniumandroid-uiautomator

Recognize page elements/objects of an android application having screenshot disabled in all the screens


I am using a banking app (Android app). The app doesn't allow screenshots to be taken. When I open UI Automator Viewer and try to take a screenshot, I am getting the following error:

'Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist! Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!'

I am using Appium + Selenium for automation.

Question:

  1. Is there any way to programmatically activate the screenshot feature in the app?

  2. Is there a way to find the root object in the application screen and iterate through all the child objects recursively and print their attributes/properties (as PageObjectModel)?

Please help me. Thanks.


Solution

  • Figured out the work-around with the following steps:

    1. Open the application
    2. use driver.getPageSource() to get the page source as string
    3. Parse the page source string and identify the element I need to work with. Then store the element's attributes in a descriptive way in the Page Object Model class

    Let me know if anyone have a better idea. Thanks