تخطى إلى المحتوى الرئيسي

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

await browser.lock(seconds)

Parameters

NameTypeDetails
seconds
optional
numberHow 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

Support for ios Support for android

Supported platforms: iOS, Android

ملاحظة

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

Welcome! How can I help?

WebdriverIO AI Copilot