Skip to content

transport-appium

Appium transport — evaluates expressions inside Obsidian Mobile via WebView JavaScript injection. Manages vault lifecycle via localStorage and file push.

Configured via environmentOptions.obsidianTransport in vitest config:

vitest.config.ts
environmentOptions: {
obsidianTransport: {
type: 'obsidian-android-appium',
appiumUrl: 'http://localhost:4723',
avdName: 'obsidian_test',
},
}

For BrowserStack, set appiumUrl to the BrowserStack hub URL — the transport itself is hub-agnostic.

Obsidian Mobile stores its vault registry in the WebView’s localStorage:

  • mobile-external-vaults — JSON array of registered vault paths - mobile-selected-vault — the currently active vault path - enable-plugin-<vaultPath>"true" to enable the plugin system for the vault

To register a vault programmatically (without UI interaction):

  1. Push vault files to the device (e.g. /sdcard/Documents/<Name>/.obsidian/app.json) 2. Switch to WEBVIEW_md.obsidian context 3. Set the localStorage entries 4. Call location.reload() — Obsidian re-reads localStorage and opens the vault

This avoids the onboarding flow entirely.

ClassDescription
AppiumTransportTransport that communicates with Obsidian Mobile via Appium WebView JS injection. Evaluates expressions by switching to the WEBVIEW_md.obsidian context and calling execute(). Manages vaults by writing to the WebView’s localStorage (which Obsidian uses as its vault registry on mobile) and pushing files to the device.
InterfaceDescription
AppiumSessionInfoSession connection info returned by AppiumTransport.getSessionInfo, used to reattach from another process.
AppiumTransportConfigConfiguration for the Appium transport.