因此我们正在测试一个应用程序,在该应用程序中我们需要更改流程之间的模式以完全测试流程。我什至尝试过此操作,但它不起作用: 整数 x_topLeftCorner=257; 整数 y_topLeftCorner=1235;
Integer x_topRightCorner=572;
Integer y_topRightCorner=1235;
Integer x_bottomLeftCorner= 260;
Integer y_bottomLeftCorner=1438;
Integer x_bottomRightCorner=532;
Integer y_bottomRightCorner=1504;
//Use coordinates to draw the security pattern and unlock the screen
TouchAction obj = new TouchAction(MBase.getDriver());
obj.press(x_topLeftCorner,y_topLeftCorner).moveTo(x_topRightCorner,y_topRightCorner).moveTo(x_bottomLeftCorner,y_bottomLeftCorner).moveTo(x_bottomRightCorner,y_bottomRightCorner).release().perform();
public static void AndroidLaunchApp() throws MalformedURLException {
UiAutomator2Options options = new UiAutomator2Options();
options.setPlatformName("Android");
options.setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2);
options.setDeviceName("R5CR11DNX9X");
options.autoGrantPermissions();
options.setApp(System.getProperty("user.dir")+"/apps/falcon.apk")
.setUnlockType("pattern")
.setUnlockKey("74123698");
try {
driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
Thread.sleep(100);
} catch (MalformedURLException | InterruptedException e) {
throw new RuntimeException(e);
}
在您的功能部分使用此功能来解锁设备
要激活设备,请使用 adb shell 命令 - adb shell 输入 keyevent KEYCODE_POWER