Auto accept permissions in Android - M

I am seeing that appium doesnt recognize the system alerts like permission Accept/Deny for android M and above?

I am using appium_lib. is there any work around for this scenario? I heard, I can use the autoacceptalert and set it to true. I am not aware of the syntax of the same in ruby, any body can advise me on this?

My current desired capabilities are

 require "appium_lib"

def caps
  {
      caps:{ deviceName: "Samsung",
             platformName: "Android",
             app: (File.join(File.dirname(__FILE__), "abs.apk")),
             Packagename: "br.com.abc",
             newCommandTimeout: "3600",
             autoAcceptAlerts: "true",
             appium_lib: { wait: 20,
                           debug: false,
             }
      }
  }
end


def server_url
  'http://0.0.0.0:4723/wd/hub'
end

Appium::Driver.new(caps)   #Pass capabilities for appium inside the driver
Appium.promote_appium_methods Object #Makes all appium_lib methods accessible from steps

@reach2jeyan try to change “autoAcceptAlerts” -> “autoGrantPermissions”
This is grand all permissions and make no alerts (if it acceptable for you).

Java:

capabilities.setCapability("autoGrantPermissions", "true");
1 Like

Thanks…

My bad, I am able to interact with the alerts like normal elements itself. Texts are case sensitive

But Ill anyway have your code, in my list. Its useful to reduce the execution time and saves me from unnecessary steps.