Appium Troubleshooting the lock screen screenshot (Java chapter)

Source: Internet
Author: User
Tags appium

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.