메인 컨텐츠로 건너뛰기

unlock

Unlock 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.unlock({ strategy, timeoutMs, unlockKey, unlockType })
Parameters
NameTypeDetails
options
optional
objectUnlock options (Android only)
options.strategy
optional
stringThe unlock strategy to use. Accepted values: 'locksettings' (default) or 'uiautomator'.
ANDROID-ONLY
options.timeoutMs
optional
numberThe timeout in milliseconds to wait for the unlock to complete. Default is 2000.
ANDROID-ONLY
options.unlockKey
optional
stringThe PIN, password, or pattern to use for unlocking. Required when the device has a PIN/password lock.
ANDROID-ONLY
options.unlockType
optional
stringThe type of lock mechanism on the device (e.g. 'pin', 'password', 'pattern').
ANDROID-ONLY
Example
unlock.js
it('should unlock the device screen', async () => {
// Unlock with no arguments (iOS or Android with default settings)
await browser.unlock()
})
it('should unlock Android with a PIN', async () => {
// Android-only: unlock using locksettings strategy with a PIN
await browser.unlock({
strategy: 'locksettings',
unlockType: 'pin',
unlockKey: '1234'
})
})
it('should unlock Android with a custom timeout', async () => {
// Android-only: unlock with a custom timeout
await browser.unlock({ timeoutMs: 5000 })
})
Support

Support for ios Support for android

참고

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

Welcome! How can I help?

WebdriverIO AI Copilot