Zum Hauptinhalt springen

background

Send the currently running app for this session to the background.

Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the mobile: execute method.

Pass -1 to keep the app in the background indefinitely, or null to send the app to the background without restoring it.

Usage

await browser.background(seconds)

Parameters

NameTypeDetails
secondsnumber, nullNumber of seconds to background the app. Pass -1 to keep it
in the background indefinitely, or null to not restore it.

Example

background.js
it('should background the app', async () => {
// Background the app for 5 seconds
await browser.background(5)
// Background the app indefinitely
await browser.background(-1)
})

Support

Support for ios Support for android

Supported platforms: iOS, Android

Hinweis

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

Welcome! How can I help?

WebdriverIO AI Copilot