Search code examples
androidui-automationandroid-6.0-marshmallowselendroid

Dismissing Android 6.0 permission required dialog in Selendroid automation test


I have searched for many times among Google / StackOverflow to seek an answer.
Originally (Before Android 6.0) my automation codes runs smoothly, but everything now is blocked by permission required dialog.
My App need to save data into SD Card and I found I can't use Selendroid automation to dismiss SD Card permission required dialog created by com.android.packageInstaller process during run-time test.
I know that I can pre-config the permissions of my App manually but every time when I reinstall my App with Jenkins, or start a new session of Selendroid to test my App, all configuration is wiped out.

From my current understanding, here are possible ways to resolve this problem:
1. Add "NoReset" flag to tell Selendroid not wiping out current setting, but I can't find it on selendroid.io
2. Use Appium instead (their documents says they have NoReset flag for Android), but this will take some time to porting my codes from Selendroid to Appium.
And I can only know whether it works or not after porting is finished.
3. Any other way that provided by Google, but I just can't find it.

If someone that have experienced similar problems and have some information could share with me, I will deeply appreciate your kindly help, thanks.


Solution

  • The setting u are looking for is prolly:

    SelendroidConfiguration config = new SelendroidConfiguration();
    config.setNoClearData(true);
    

    This way u will only have to give any permission once and the OS will remember ever after.