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

**URL:** <https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910>\
**Category:** Support\
**Created:** [March 12, 2024, 11:42am UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910 "2024-03-12T11:42:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![manoj\_a](https://discuss.appium.io/user_avatar/discuss.appium.io/manoj_a/32/12682_2.png) [@manoj\_a](https://discuss.appium.io/u/manoj_a)\
**Post date:** [March 12, 2024, 11:42am UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910/1 "2024-03-12T11:42:21Z")

</div>

I am trying to click on the ‘Allow once’ button in the location pop-up in iOS but for some reason, I am unable to interact with it.

I tried with both xpaths and accept alert still the result was same. Xapth I used `//*[contains(@label, 'Allow Once')]` and `driver.switchTo().alert().accept();`

 ![image](https://discuss.appium.io/uploads/default/original/2X/7/78d4c4339205ba86def1c3c22f4d19943415d85a.jpeg)

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [March 12, 2024, 12:47pm UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910/2 "2024-03-12T12:47:06Z")

</div>

try →

```auto
// 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) {
        }

```

---

<div class="post-metadata">

**Author:** ![manoj\_a](https://discuss.appium.io/user_avatar/discuss.appium.io/manoj_a/32/12682_2.png) [@manoj\_a](https://discuss.appium.io/u/manoj_a)\
**Post date:** [March 12, 2024, 2:33pm UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910/3 "2024-03-12T14:33:15Z")

</div>

It worked, thank you

---

<div class="post-metadata">

**Author:** ![manoj\_a](https://discuss.appium.io/user_avatar/discuss.appium.io/manoj_a/32/12682_2.png) [@manoj\_a](https://discuss.appium.io/u/manoj_a)\
**Post date:** [June 17, 2025, 3:52pm UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910/4 "2025-06-17T15:52:57Z")

</div>

Hi @Aleksei  
Just wanted to understand why we are giving the locator has String instead of iOSClassChain or xpath

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [June 17, 2025, 4:53pm UTC](https://discuss.appium.io/t/unable-to-click-on-allow-once-in-ios-precise-location-pop-up/41910/5 "2025-06-17T16:53:26Z")

</div>

Just cause `iOSClassChain` much more flexible then just id or e.g. predicate.
