简体   繁体   中英

Appium Android pop up

I am trying to automate android application using appium when I launch the application and try to login the pop up asks me to have access to Contacts by tapping on "Allow". The pop up have a different appPackage and it is not part of the application package.

Locator for the allow button

addLocator(Locators.ALLOW_CONTACTS,     "com.android.packageinstaller:id/permission_allow_button");

method to tap on Allow button

Button allowContactsButton() {
        return new Button(getLocator(Locators.ALLOW_CONTACTS));
    }

public void dismissAllowContact() {
        allowContactsButton().tap();
    }

The dismiss function does is able to locate the button but does not tap on it

You can turn on autoAcceptAlerts and grant permissions.

desiredCapabilities.setCapability("autoGrantPermissions", "true");
desiredCapabilities.setCapability("autoAcceptAlerts", "true");

For location service you will have to explicity set authorization using following:

desiredCapabilities.setCapability("locationServicesAuthorized", "true");

You can try similar approach for contacts.

Hoping this helps !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM