Skip to main content

Eval

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

Run a JavaScript expression in the current WebView and return its value as a string. These call app_eval.

Eval​

func (d *Device) Eval(ctx context.Context, expression string) (string, error)

Eval runs a JavaScript expression in the current WebView and returns its value as a string. Objects come back as JSON.

Examples​

Read the page title in a WebView​

title, err := dev.Eval(ctx, "document.title")
if err != nil {
return err
}
fmt.Println(title)

On a device​

mobium eval document.title on an Android 15 emulator

mobium eval document.title on an Android 15 emulator