Skip to main content

batch

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

Run several tools in order, on one device, in one call — a known sequence such as tap, type, tap, without a round trip for each. These call app_batch.

batch​

public List<Map<String, Object>> batch(List<Map<String, Object>> steps)

Runs several tools in order, on this device, in one call:

device.batch(List.of(
Mobium.step("app_tap", Map.of("target", "text=Sign in")),
Mobium.step("app_wait_for", Map.of("target", "text=Welcome"))));
}```

Every step is checked before the first runs, and the batch stops at the
first failure, throwing that step's own exception; its `details()`
hold `step` and what `completed` before it.

@param steps the steps, each from `step(String, Map)`
@return each step's `name`, `text` and `data`, in order

## Examples

### Tap through two screens in one call

```java
List<Map<String, Object>> results = device.batch(List.of(
Mobium.step("app_tap", Map.of("target", "text=Network & internet")),
Mobium.step("app_wait_for", Map.of("target", "text=Internet"))));

The same call from the command line, mobium batch steps.json, printed on an Android 15 emulator:

1. app_tap: tapped text=Network & internet at (407, 867)
2. app_wait_for: text=Internet is visible after 1.222s — @e3 Internet AndroidWifi (button)

mobium batch steps.json on an Android 15 emulator

mobium batch steps.json on an Android 15 emulator