以编程方式使用 PIN 码解锁 android 手机 Selenium 移动自动化

Unlock android mobile with PIN code programmatically Selenium mobile automation

我有一个任务需要在 Java.I 中使用 Appium 和 selenium 编写 Android 移动测试自动化必须执行 phone 必须使用 PINCODE pro 解锁的场景语法方式。

在自动化测试中是否可以使用密码解锁 android 手机?谁能给我任何建议来完成这个任务。

尽管 appium 可以唤醒我们的设备,但 Appium 无法解锁 pattern/pin 锁。要lock/Unlock屏幕我们需要使用ADB命令,下面是几个例子你可以试试看:

将设备从睡眠模式唤醒

adb shell input keyevent KEYCODE_POWER

向上滑动获取密码屏幕

adb shell input swipe 800 400 400 400

输入 PIN

adb shell input text 0000

点击回车解锁

adb shell input keyevent KEYCODE_ENTER