← Node guide
Device actions

Shell Command

Runs one shell command on the phone and hands what it printed to the steps after it. Android only — iOS has no device shell.

device.shell
The piece

Run a shell command on the device and pass what it printed to the next steps — package lists, dumpsys, settings, file checks. Android only: iOS has no device shell.

Reach for it when

  • Reading state no screen shows: installed packages, battery detail, a settings value, whether a file is there.
  • Setting something up before the UI part of the test starts.
Shell Command
Idle
In the bag

Every setting this block has. A field marked only when appears once you have chosen the mode above it — those are alternatives to each other, not extra things to fill in.

  • CommandRequired
    starts at —

    Runs through the device's own sh, so pipes, && and redirects work — e.g. pm list packages -3, dumpsys battery, settings get global airplane_mode_on.

  • Timeout
    starts at 20s

    Give up if the command hasn't finished by then. This is billed device time.

  • Fail on non-zero exit
    starts at on

    Treat a non-zero exit code as a failed step. Turn off when a non-zero result is a legitimate answer (grep finding nothing) — the code is still reported as {{ $Shell Command.json.exitCode }}.

Build it
  1. Write the command

    It goes through the device's own sh, so pipes, && and redirects all work.

    Shell CommandSettings
    CommandRuns through the device's sh
    pm list packages -3
    TimeoutThis is billed device time
    20s
    Fail on non-zero exit
    on
  2. Read what it printed

    adb shell$ pm list packages -3package:com.acme.shoppackage:com.acme.betaexit 0
    stdout → the next step
  3. Decide whether a non-zero exit is a failure

    Turn Fail on non-zero exit off when a non-zero answer is legitimate — grep finding nothing, for instance. The code is still readable as {{ $Shell Command.json.exitCode }}.

    Shell Command
    If / Branch
What comes out
  • What the command printed, and its exit code.
Watch out
  • Android only — and on an iPhone the step FAILS rather than being skipped, because Apple’s sandbox has no adb equivalent to fall back to. In a mixed Android/iOS run, keep it on an Android-only branch.
  • The timeout is device time you are paying for. A command that hangs costs the full 20 seconds every run.
Usually next to