Unlock android mobile with PIN code programmatically Selenium mobile automation

安稳与你 提交于 2019-12-11 08:25:20

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/40145397/unlock-android-mobile-with-pin-code-programmatically-selenium-mobile-automation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!