2

I have a task that I need to write Android mobile test automation using Appium and selenium in Java.I have to do scenario that phone has to be unlock using PINCODE pro-grammatical way.

Is there anyway to unlock android mobile in automation tests using pincode? Can anyone give me any suggestions to do this task.

  • I have gone through some references.But I could not find anything related to unlock using PIN Code.FYI https://discuss.appium.io/t/is-it-possible-to-open-the-lock-by-using-appium-in-android/2612 – satkunam rajeenthini Oct 20 '16 at 06:06
  • Related question: [how to unlock an android phone with password programatically](https://stackoverflow.com/q/66131586/1455694) – Anton Samokat Nov 06 '22 at 21:35

1 Answers1

2

There is no capability in Appium to unlock the pattern/pin lock though appium can wake our device up. To lock/Unlock the screen we need to use ADB commands, below are few examples you can give a try to:

To wake the device from sleep mode

adb shell input keyevent KEYCODE_POWER

To swipe up for obtainging the PIN screen

adb shell input swipe 800 400 400 400

Enter PIN

adb shell input text 0000

Tap on Enter to unlock

adb shell input keyevent KEYCODE_ENTER
Keshav
  • 415
  • 2
  • 12