Retrieving the XPATH while Android app has screen protection enabled

In Appium I’m trying to automate an application but it has screenshot protection enabled, so I am not able to use the UI Automator 2 to retrieve the XPATHs that I need.

Is there a way around this or another way to do this?

Currently, I’m using a virtual Android device running stock Android 11

Thank you in advance!


I did managed to get the XML but I have no clue how I can use it to click buttons etc.

I would explain the problem to the developers and ask if they can remove that protection from the debug build, which will be used only for testing and automation.