launchApp
Launch or activate an app on the device. If no bundleId (iOS) or appId (Android) is provided,
the command will automatically detect and activate the currently active app.
Usage
await browser.launchApp({ bundleId, arguments, environment, appId })
Parameters
| Name | Type | Details |
|---|---|---|
optionsoptional | object | Options for launching the app (optional) |
options.bundleIdoptional | string | The bundle ID of the iOS app to launch. If not provided, the currently active app is used. iOS-ONLY |
options.argumentsoptional | string, string[] | Command line arguments to pass to the app on launch. iOS-ONLY |
options.environmentoptional | object | Environment variables to set when launching the app (key-value pairs). iOS-ONLY |
options.appIdoptional | string | The package name of the Android app to activate. If not provided, the currently active app is used. ANDROID-ONLY |
Example
launchApp.js
it('should launch a specific iOS app', async () => {
// iOS: launch a specific app by bundle ID
await browser.launchApp({ bundleId: 'com.example.myapp' })
})
it('should launch an iOS app with arguments and environment', async () => {
// iOS: launch an app and pass arguments and environment variables
await browser.launchApp({
bundleId: 'com.example.myapp',
arguments: ['-AppleLanguages', '(en)'],
environment: { MY_ENV_VAR: 'value' }
})
})
it('should launch a specific Android app', async () => {
// Android: activate/launch a specific app by package name
await browser.launchApp({ appId: 'com.example.myapp' })
})
it('should activate the currently active app', async () => {
// Automatically detect and activate the current app
await browser.launchApp()
})
Support
Supported platforms: iOS, Android
note
Refer to the official Appium driver documentation to see which driver versions support this command.