Today, a little friend asked me, how to unlock the lock screen operation?
A, the idea after the initialization driver, joins waits to determine whether has the lock screen (element) (remembers to join Waits)
B, if there is to unlock, the general input digital password and then unlock (of course, you need to know how to unlock the gesture password please refer to my other blog)
Below the previous figure, you can refer to see, the overall please combine their own phone to do the corresponding processing
Do more work, less talk to look at the picture:
Look at the code:
Mobile phone lock Screen unlock
@Test
public void Lockcreen () {
try {
Thread.Sleep (5000);//Remember to wait
} catch (Interruptedexception e) {
E.printstacktrace ();
}
Determine if the element is present (of course, there are other logic to handle itself)
if (Driver.getpagesource (). Contains ("Com.android.systemui:id/keyguard_bouncer_frame")) {
Driver.findelementbyid ("Com.android.systemui:id/pinentry"). SendKeys ("5620");//Enter password
Driver.findelementbyid ("Com.android.systemui:id/key_enter"). Click ();//tap OK
}
}
--------------------------------last animated----------------------------------------------------------------------------------- -------------------------------------------------------------
Appium Troubleshooting the lock screen screenshot (Java chapter)