跳到主要内容

isLocked

Check whether the device screen is locked.

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

Usage

await browser.isLocked()

Example

isLocked.js
it('should check if the device is locked', async () => {
const locked = await browser.isLocked()
console.log('Device is locked:', locked)
})

Returns

  • <Promise<boolean>> returns: true if the device is locked, false otherwise

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