work well now for oneplus 8t

This commit is contained in:
2023-10-21 19:00:47 +02:00
parent dda926bdcd
commit 8f8e1c5f87
2 changed files with 19 additions and 12 deletions
+18 -11
View File
@@ -205,10 +205,14 @@ class CommandorPage {
} }
let cancel let cancel
const intervalTask = setInterval(() => { const intervalTask = setInterval(async () => {
if (this.isTerminated) { if (this.isTerminated) {
log(this.device.model() + ":request terminated, send cancel()"); log(this.device.model() + ":request terminated, send cancel()");
// this.resetBrowser(); try {
await this.page.close()
} catch (e) {
console.log(e)
}
this.disconnectBrowser(); this.disconnectBrowser();
clearInterval(intervalTask) clearInterval(intervalTask)
cancel() cancel()
@@ -555,14 +559,14 @@ class CommandorPage {
await delay(getRandomWaitTime()) await delay(getRandomWaitTime())
try { try {
if (!this.page.isClosed()) { if (!this.page.isClosed()) {
if (!this.isTerminated && !this.page.isClosed()) { // if (!this.isTerminated && !this.page.isClosed()) {
this.page.evaluate(() => { // this.page.evaluate(() => {
let element = document.getElementsByClassName("btn")[0]; // let element = document.getElementsByClassName("btn")[0];
if (typeof element !== 'undefined') // if (typeof element !== 'undefined')
document.getElementsByClassName("btn")[0].focus(); // document.getElementsByClassName("btn")[0].focus();
}) // })
} // }
await delay(getRandomWaitTime()) // await delay(getRandomWaitTime())
if (!this.page.isClosed()) { if (!this.page.isClosed()) {
try { try {
// remove debug flag // remove debug flag
@@ -980,6 +984,8 @@ class CommandorPage {
await this.device.shell("input tap " + 530 + " " + 970) await this.device.shell("input tap " + 530 + " " + 970)
else if (this.device.model() === "ONEPLUS A6000") else if (this.device.model() === "ONEPLUS A6000")
await this.device.shell("input tap " + 530 + " " + 1064) await this.device.shell("input tap " + 530 + " " + 1064)
else if (this.device.model() === "KB2003")
await this.tapForDevice(this.device, 500, 1200)
else else
try { try {
await this.tapForDevice(this.device, 500, 1120) await this.tapForDevice(this.device, 500, 1120)
@@ -994,7 +1000,7 @@ class CommandorPage {
if (this.device.model() === "MI 5s") if (this.device.model() === "MI 5s")
await this.device.shell("input tap " + 60 + " " + 1400) await this.device.shell("input tap " + 60 + " " + 1400)
else else
await this.device.shell("input tap " + 455 + " " + 1920) await this.tapForDevice(this.device, 455, 1920)
await delay(2000); await delay(2000);
await this.checkResultWithOcr(); await this.checkResultWithOcr();
break; break;
@@ -1109,6 +1115,7 @@ class CommandorPage {
async tapForDevice(device, x, y) { async tapForDevice(device, x, y) {
let cmd = `adb -s ${device.serial()} shell input tap ${x} ${y}` let cmd = `adb -s ${device.serial()} shell input tap ${x} ${y}`
logWithDevice("cmd is " + cmd, this.device)
await exec(cmd); await exec(cmd);
} }
+1 -1
View File
@@ -178,7 +178,7 @@ class OCRChecker {
await this.deleteFile(screenShot) await this.deleteFile(screenShot)
return OCRResult.BRAVE_PRIVACY_PUB return OCRResult.BRAVE_PRIVACY_PUB
} else { } else {
return OCRResult.TERMINAED`` return OCRResult.TERMINAED
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)