Unlock screen with passcode

I’m looking for a way to unlock the screen of real devices (android, iOS, and windows) in order to run tests integrated with Jenkins on real devices. So far, I’ve found a way of doing this on Android using adb but am still unable to find a way to do this on iOS or windows, but would prefer to use Katalon/Appium as I also anticipate scenarios where during execution the screen locks. It would appear that the unlock screen keyword is still dependent on having a person start the test with the screen unlocked. Does anyone know a way that this can be done automatically on the three platforms (preferably using Katalon/Appium)? Thanks!

1 Like

Same question here. All of our devices need to have pin enabled otherwise they could not connect to our network so we have the same issue when executing tests via Jenkins.
Ideally, there would be built in keyword “UnlockScreen” that takes in pin as parameter.

@thongnmtran - Hi dude, any chance of helping out with this situation? So I have an Android device set up with a PIN and I wanted to test notifications on the lock screen. The lock command you mentioned in How to lock mobile device? driver.lockDevice() works fine but driver.unlockDevice() or the Unlock Device Katalon command is failing. With the device set to swipe, the unlockDevice() command will unlock the phone and swipe up to get to the main screen successfully. With a security lock, I can see the device unlocks to display the lock screen successfully but Katalon then throws an error.

The error is showing: Reason: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'io.appium.unlock' application.

I assume driver.unlockDevice() is using the Unlock application on the device but it cannot access this due to the lock protection on the device.

Can you think of or do you know a way to unlock the device when it has a security lock applied? Thank you

Hi @mohammad.arif, Hi @Micaela_Connors,

To unlock Android device which has security protection, you could add these two capabilities to your Desired Capabilities section /=)

  • unlockType: one of “pin”, “password”, “pattern” or “fingerprint
  • unlockKey: your passcode, e.g. “1234”

For more details please follow this link: appium-android-driver/UNLOCK.md at master · appium/appium-android-driver · GitHub

But unfortunately, there is still no similar way to unlock a real iOS device. The Katalon keyword Mobile.unlockScreen() only work when it is “Slide To Unlock”. Or the Appium method performTouchID() could only work with the Simulator. :upside_down_face: