How to enable/disable app permission using Appium?

Suban Dhyako picture Suban Dhyako · Sep 6, 2018 · Viewed 9.1k times · Source

My app need the multiple app permission. I need to check how my app behaves by allowing or denying the different permission. How can i enable/disable the app permission from the appium to create the multiple scenario?

For example lets say my app need to permissions: permission1 and permission2.

scenario 1 = allow permission1 allow permission2

scenario 2 = allow permission1 deny permission2

scenario 3 = deny permission1 allow permission2

scenario 4 = deny permission1 deny permission2

Answer

anne picture anne · Jan 4, 2019

The above answers didn't resolve my problem. I solved this problem by using the the caps of "autoGrantPermissions".

Setup:

desired_caps['autoGrantPermissions'] = True

You will have to disable the noReset caps to False, otherwise it won't work. See reference here: http://appium.io/docs/en/writing-running-appium/caps/