Skip to main content

mobium hook

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Call a hook the app registered with its gray-box library

A hook is a function the app registered by name with Mobium's gray-box library — sign in, seed data, raise a toast — so a test can set up state without walking the UI. The app must be launched with launch --gray-box. The call is written into a field the library adds only in a gray-box launch, and the answer read from the device log; what the hook returns is printed as JSON. On iOS the call is typed, about 16 ms a character. An unknown name is refused, naming the hooks the app registered.

Usage​

mobium hook <name> [args...] [flags]

Flags​

FlagTypeDefaultWhat it does
--timeout-msint15000How long to wait for the app's answer

And the global flags.

Examples​

Call a hook the app registered, and get back what it answered​

mobium hook raiseToast "Toast raised by test script"

Printed on an Android 15 emulator:

hook raiseToast answered: "shown"
gray box: the app was idle

mobium hook raiseToast &quot;Toast raised by test script&quot; on MobiumApp, Android 15 emulator, launched with --gray-box: the app&#39;s own toast says what the hook was sent

mobium hook raiseToast "Toast raised by test script" on MobiumApp, Android 15 emulator, launched with --gray-box: the app's own toast says what the hook was sent

More, from mobium hook --help​

mobium launch --gray-box dev.mobium.mobiumapp
mobium hook raiseToast "Toast raised by test script"
mobium hook signIn mobium
mobium hook screen

The tool​

hook calls app_hook; its arguments and what every client calls it are there.