Lock Screen (FR)
Perfecto Command
mobile:screen:lock
Purpose
Locks the device screen for a specified number of seconds. Check instantly how your app behaves when the screen is locked.
Restriction:
mobile:screen:lock
does not work on real iOS 17 devices with StandBy mode enabled. To be able to use this function on a real iOS 17 device that is locked, disable StandBy mode (under Settings > StandBy).Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
timeout | Integer | Time, in seconds, to lock device (default: 10) |
Return Value
OK - if successful
Exceptions
None
Examples
Copy
Java sample
Map<String, Object> param = new HashMap<>();
param.put("timeout", "3");
driver.executeScript("mobile:screen:lock", param);
Copy
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("timeout", "3");
driver.ExecuteScript("mobile:screen:lock", pars);