start · sessions · quit
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Start or end the session on a device. These call app_session.
start
export function start(options?: StartOptions): Promise<Device>
Connect and open the session on the device.
End it with quit().
sessions
sessions(): Promise<{ device: string; platform: string; driver: string }[]>
The sessions open on the daemon.
quit
quit(): Promise<void>
End the session on the device and close the connection. The app start() launched, if any, is stopped too.
Examples
Start a session and launch the app fresh
import { start } from 'mobium'
const device = await start({ app: 'com.android.settings' })
The same call from the command line, mobium session start --app com.android.settings, printed on an Android 15 emulator:
session already open on emulator-5554 (android, uiautomator2); com.android.settings was launched fresh and is in the foreground
End it, putting back what it changed
await device.quit()
The same call from the command line, mobium session end, printed on an Android 15 emulator:
session ended on emulator-5554; anything it changed for the session is put back; com.android.settings, which the session launched, was stopped
More examples
Open a session on the one running device
import { start } from 'mobium'
const device = await start()
try {
console.log(device.session?.platform, device.session?.driver)
} finally {
await device.quit()
}
Pick the device and platform, and launch an app
import { start } from 'mobium'
const device = await start({ platform: 'ios', device: 'booted', app: 'com.apple.Preferences' })
List the sessions open on the daemon
for (const s of await device.sessions()) console.log(s.device, s.platform, s.driver)
End the session, whatever happens
try {
await device.tap('text=Network & internet')
} finally {
await device.quit()
}