For the function of the pattern unlocking in the application, the use of appium can accomplish this function well.
Here is an example of a lock screen when the pattern is unlocked:
The pattern is set to:
Unlock in the lock screen:
When you get the coordinates of 9 points in a pattern, you can get them using the Hierarchyviewer tool in the SDK Tools directory.
The following code is unlocked:
Package Com.xuxu.autotest;import Java.net.url;import io.appium.java_client. Appiumdriver;import io.appium.java_client. Touchaction;import Io.appium.java_client.android.androiddriver;import Org.junit.after;import Org.junit.Before; Import Org.junit.test;import Org.openqa.selenium.remote.desiredcapabilities;public class Unlocktest {private Appiumdriver driver;public unlocktest () {} @Beforepublic void SetUp () throws Exception {Desiredcapabilities capabilities = new Desiredcapabilities (); Capabilities.setcapability ("DeviceName", "Android Emulator"); Capabilities.setcapability ("Platformversion", "4.4"); Capabilities.setcapability ("PlatformName", "Android"); Capabilities.setcapability ("Apppackage", "com.android.settings"); Capabilities.setcapability ("Appactivity", ". Settings ");d river = new Androiddriver (New URL (" Http://127.0.0.1:4723/wd/hub "), capabilities); Sleep (2000);} @Afterpublic void TearDown () throws Exception {Driver.quit ();} @Testpublic void Test () {driver.sendkeyevent (26);//press Power key to lock the screen sleep (3000);d River.sendkeyevent (26); Press the Power key to light the screen Driver.tap (1, 540, 960, 500); Touch the middle of the screen to show the Pattern Unlock Box Sleep (2000);//pattern unlock touchaction action = new touchaction (driver); Action.press (215, 870). MoveTo (540, 870). MoveTo (862, 870). MoveTo (540, 1195). MoveTo (215, 1195). MoveTo (215, 1518). MoveTo (862, 1518). MoveTo (862, 1195). Release (). perform (); private void sleep (int i) {try {thread.sleep (i);} catch (Interruptedexception e) {//TODO auto-generated catch Blocke.prin Tstacktrace ();}}}
Finally, attach a video of the unlocking process that was recorded using Screenrecord during the execution of the script:
Unlok.mp4
Pattern unlock with Appium