Skip to main content

Speech

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

What the screen reader says — VoiceOver on a real iPhone (iOS 27, a runner built by Xcode 27), TalkBack on Android. These call app_speech.

Speech​

func (d *Device) Speech(ctx context.Context, opts SpeechOptions) (Speech, error)

Speech reports what the screen reader says — VoiceOver on a real iPhone, TalkBack on Android — about the element its cursor is on, or with opts.Walk about each element in its own order. The screen reader must be on: Accessibility(ctx, "screen_reader", "on").

Examples​

Say what the screen reader says about the element its cursor is on​

said, err := dev.Speech(ctx, mobium.SpeechOptions{})
if err != nil {
return err
}
fmt.Println(said.Steps[0].Said)

The same call from the command line, mobium speech, printed on an Android 15 emulator:

TalkBack says: "not checked. Pro. Radio button" — Pro (radio)

Walk the screen in the screen reader's order, each sentence beside its element​

walk, err := dev.Speech(ctx, mobium.SpeechOptions{Walk: true, Limit: 20})
if err != nil {
return err
}
for _, step := range walk.Steps {
fmt.Println(step.Said)
}
fmt.Println("ended:", walk.Ended)

The same call from the command line, mobium speech --walk --limit 20, printed on an Android 15 emulator:

TalkBack says:
1. "not checked. Team. Radio button" — Team (radio)
2. "OFF. Dark mode. Switch" — Dark mode (switch)
3. "Dark mode, for the whole app" — Dark mode, for the whole app, not in map
4. "Read-only" — Read-only, not in map
5. "This field cannot be edited. Edit box. disabled"
6. "notify=false terms=false plan=free theme=light" — notify=false terms=false plan=free theme=light, not in map
7. (nothing)
8. "Back. Button" — Back (button)
9. "Form" — Form, not in map
10. "not checked. Email me. Check box" — Email me (checkbox)
11. "not checked. Accept terms. Check box" — Accept terms (checkbox)
12. "checked. Free. Radio button" — Free (radio)
13. "not checked. Pro. Radio button" — Pro (radio)
ended: the cursor came back round to the first element

Put the screen reader's cursor on an element, and hear what it says​

said, err := dev.Speech(ctx, mobium.SpeechOptions{Target: "label=Pro"})
if err != nil {
return err
}
fmt.Println(said.Steps[0].Said)

The same call from the command line, mobium speech label=Pro, printed on an Android 15 emulator:

TalkBack says: "not checked. Pro. Radio button" — Pro (radio)

mobium speech label=Pro on an Android 15 emulator

mobium speech label=Pro on an Android 15 emulator

Start listening to the screen reader, before an action​

if _, err := dev.Speech(ctx, mobium.SpeechOptions{Listen: "start"}); err != nil {
return err
}
if err := dev.Tap(ctx, "testid=addLive"); err != nil {
return err
}

The same call from the command line, mobium speech --listen start, printed on an Android 15 emulator:

listening to TalkBack — act, then stop it with listen stop

Stop listening, and hear what the action made it say​

heard, err := dev.Speech(ctx, mobium.SpeechOptions{Listen: "stop"})
if err != nil {
return err
}
for _, step := range heard.Steps {
fmt.Println(step.Said, step.Cause)
}

The same call from the command line, mobium speech --listen stop, printed on an Android 15 emulator:

TalkBack said, since listening started: "Live cart: 1" — Live cart: 1, not in map [a change on screen]