use adb to start browser

This commit is contained in:
Lei PAN
2023-10-25 08:59:46 +02:00
parent cc868e0110
commit 00d70cd00f
3 changed files with 39 additions and 32 deletions
+19 -13
View File
@@ -146,7 +146,7 @@ class CommandorPage {
async loadPage() {
logWithDevice(this.device.serial() + ":loadPage() called, with port:" + this.port, this.device);
try {
await this.device.shell("am start -n " + this.browserPackageName + "/com.google.android.apps.chrome.Main")
await this.startPage(this.device, this.browserPackageName + "/com.google.android.apps.chrome.Main")
await delay(5 * 1000);
} catch (e) {
console.log(e)
@@ -201,9 +201,6 @@ class CommandorPage {
await this.enableDisableAirPlanMode();
await delay(10 * 1000);
await this.clickOnlineAppointment();
// await delay(2000);
// if (!this.isTerminated)
// await this.clickOnlineAppointment();
} else {
this.isTerminated = true;
}
@@ -1002,9 +999,9 @@ class CommandorPage {
await this.checkResultWithOcr();
break;
case OCRResult.BRAVE_PRIVACY_PUB:
if (this.device.model() === "MI 5s")
await this.device.shell("input tap " + 60 + " " + 1400)
else
if (this.device.model() === "MI 5s") {
await this.tapForDevice(this.device, 60, 1400)
} else
await this.tapForDevice(this.device, 455, 1920)
await delay(2000);
await this.checkResultWithOcr();
@@ -1016,7 +1013,8 @@ class CommandorPage {
else if (this.device.model() === "22041219PG")
await this.device.shell("input tap " + 530 + " " + 1600)
else
await this.device.shell("input tap " + 500 + " " + 1680)
await this.tapForDevice(this.device, 500, 1680)
// await this.device.shell("input tap " + 500 + " " + 1680)
await delay(2000);
await this.checkResultWithOcr();
break;
@@ -1230,9 +1228,9 @@ class CommandorPage {
async tapGoogleDisconnectBtn() {
if (this.device.model() === "MI 5s") {
if (this.browserPackageName.includes("brave"))
await this.device.shell("input tap " + 535 + " " + 1629)
else
if (this.browserPackageName.includes("brave")) {
await this.tapForDevice(this.device, 535, 1629)
} else
await this.device.shell("input tap " + 550 + " " + 1740)
} else {
if (this.browserPackageName.includes("brave") && this.device.model() === "CPH2219") {
@@ -1243,11 +1241,19 @@ class CommandorPage {
await this.device.shell("input tap " + 411 + " " + 1970)
} else if (this.browserPackageName.includes("brave") && this.device.model() === "22041219PG") {
await this.device.shell("input tap " + 411 + " " + 2020)
} else
await this.device.shell("input tap " + 411 + " " + 2100)
} else {
await this.tapForDevice(this.device, 411, 2100)
}
// await this.device.shell("input tap " + 411 + " " + 2100)
}
await delay(2000);
}
async startPage(device, activity) {
let cmd = `adb -s ${device.serial()} shell am start -n ${activity}`
logWithDevice("cmd is " + cmd, this.device)
await exec(cmd);
}
}
module