Skip to main content

closeApp

Close a specific app or the currently active app on the device.

If no bundleId (iOS) or appId (Android) is provided, the command will automatically detect and close the currently active app.

Usage​

await browser.closeApp({ bundleId, appId })

Parameters​

NameTypeDetails
options
optional
objectOptions for closing the app (optional)
options.bundleId
optional
stringThe bundle ID of the iOS app to close. If not provided, the currently active app is closed.
iOS-ONLY
options.appId
optional
stringThe package name of the Android app to close. If not provided, the currently active app is closed.
ANDROID-ONLY

Example​

closeApp.js
it('should close the currently active app', async () => {
// Automatically close the currently active app
await browser.closeApp()
})
it('should close a specific iOS app by bundleId', async () => {
// iOS: close a specific app using its bundle ID
await browser.closeApp({ bundleId: 'com.example.myapp' })
})
it('should close a specific Android app by appId', async () => {
// Android: close a specific app using its package name
await browser.closeApp({ appId: 'com.example.myapp' })
})

Support​

Support for ios Support for android

Supported platforms: iOS, Android

note

Refer to the official Appium driver documentation to see which driver versions support this command.

Welcome! How can I help?

WebdriverIO AI Copilot