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
browser.background(seconds)
Parameters
| Name | Type | Details |
|---|---|---|
seconds | number, null | Number 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
备注
Refer to the official Appium driver documentation to see which driver versions support this command.