lock
Lock the device screen.
Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the
mobile:execute method.
Usage
browser.lock(seconds)
Parameters
| Name | Type | Details |
|---|---|---|
secondsoptional | number | How long to lock the screen in seconds (iOS only) |
Examples
lock.js
it('should lock the screen', async () => {
// Lock the screen indefinitely
await browser.lock()
})
lock.timeout.js
it('should lock the screen for 5 seconds (iOS only)', async () => {
// Lock the screen for 5 seconds, then auto-unlock (iOS only)
await browser.lock(5)
})
Support
Hinweis
Refer to the official Appium driver documentation to see which driver versions support this command.