Unable to click on Allow once in iOS precise location pop up

try →

// Java
            final String iosLocator = "**/XCUIElementTypeButton[`name == \"Allow Once\"`]";
            driver.setSetting("acceptAlertButtonSelector", iosLocator);
            try {
                driver.switchTo().alert().accept();
            } catch (Exception ignored) {
            }

// or 

        // prepare args
        HashMap args = new HashMap<>();
        args.put("action", "accept");
        args.put("buttonLabel","Allow Once");

        // prepare command
        String cmd = "mobile: alert";

        // execute
        try {
            driver.executeScript(cmd, args);
        } catch (Exception ignored) {
        }
3 Likes