Question: I am trying to click on the Allow button using Detox.

[![enter image description here](https://i.stack.imgur.com/cx8iT.png)](https://i.stack.imgur.com/cx8iT.png)

I have tried the following:

[Detox: iOS Simulator how to confirm alert message](https://stackoverflow.com/questions/47522081/detox-ios-simulator-how-to-confirm-alert-message)

I have also tried targeting the "Allow" button by `element(by.label('Allow')).tap()` and also `by.text`

I do not want to set location permissions upon app launch. I would like to simulate a user allowing and not allowing location permissions.

Answer: 
This is not possible using Detox. The alert is presented from a different process, while Detox operates strictly in the app's process realm.
To "Allow" I have used this with success:

```
element(by.type('_UIAlertControllerActionView')).atIndex(1);

```

And for "Don't Allow", this should work:

```
return element(by.type('_UIAlertControllerActionView')).atIndex(0);

```