alert · answer_alert · press_alert_button
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read a system dialog, or answer it. These call app_alert.
alert
def alert() -> str
What a system dialog says, or "" when none is up.
A permission prompt is another process's window, not the app's, and reading it needs no knowledge of what the buttons say.
answer_alert
def answer_alert(accept: bool=True, text: str | None=None) -> dict
Accept or dismiss a dialog of one or two buttons.
accept is yes and dismiss is no, so a two-button permission prompt is
granted by accept and denied by dismiss, in any language. A dialog of
three or more is refused, naming its buttons — more than one may mean
yes, as on iOS's location prompt — so press one with
:meth:press_alert_button. The result's pressed is the caption
pressed.
text is typed into a prompt's field first, so one call fills and answers it. A plain alert has no field, and the platform refuses it.
press_alert_button
def press_alert_button(button: str | int, text: str | None=None) -> dict
Press a dialog's button by its caption, or its position from 1.
A caption matches in any case and with straight or curly quotes; a
position counts in the order the dialog shows its buttons. Works on
any dialog, one of three buttons or an app's own included. The
result's pressed is the caption pressed. text is typed into a
prompt's field first.
Examples
Ask whether a dialog is up, what it says, and its buttons
text = device.alert()
if text:
print("dialog up:", text)
The same call from the command line, mobium alert, printed on an Android 15 emulator:
a dialog is on screen: "Discard changes?\nThey will be lost."
buttons: "KEEP EDITING", "DISCARD"

mobium alert on an Android 15 emulator
Say yes to a dialog of one or two buttons
device.answer_alert(accept=True)
The same call from the command line, mobium alert accept, printed on an Android 15 emulator:
accepted the dialog "Discard changes?\nThey will be lost.": pressed "DISCARD"
| Before | After |
|---|---|
![]() | ![]() |
mobium alert accept on an Android 15 emulator
Press a button by its caption, on a dialog of three
result = device.press_alert_button("Don't Save")
print("pressed", result["pressed"])
The same call from the command line, mobium alert --button "Don't Save", printed on an Android 15 emulator:
pressed "DON'T SAVE" on the dialog "Save this draft?\nYou can come back to it later."
| Before | After |
|---|---|
![]() | ![]() |
mobium alert --button "Don't Save" on an Android 15 emulator
More examples
Fill a prompt's field and accept it, in one call
device.answer_alert(True, text="Groceries")



