I am using Appium java-client with testNG to develop the functional test suite for android app.
To deal with system pop up which asking permission: "Allow XXXXX to access photos, media, and files on your device?" I use the class:
import io.appium.java_client.FindsByAndroidUIAutomator
driver.findElementByAndroidUIAutomator("text(\"ALLOW\")").click();
which works fine when I run my test locally(the other, like grant access when setting desiredCapabilities doesn't work). But when running on the device, it doesn't work, does anybody knows why? or is there any other way I could click the "ALLOW" or just grant the permission?