delete recognized images

This commit is contained in:
Lei PAN
2023-10-16 16:20:39 +02:00
parent 90f05e28a0
commit c9bdd3ac31
2 changed files with 17 additions and 2 deletions
+13 -1
View File
@@ -111,6 +111,11 @@ class CommandorPage {
// get url and push to server // get url and push to server
await this.fillFields() await this.fillFields()
break; break;
case OCRResult.SLIDING_CAPTCHA_REFRESH:
pages.forEach((currentPage) => {
currentPage.close()
})
break;
case OCRResult.TO_REFRESH: case OCRResult.TO_REFRESH:
logWithDevice("will reload page", this.device) logWithDevice("will reload page", this.device)
let cmd = "input swipe 382 682 382 1682" let cmd = "input swipe 382 682 382 1682"
@@ -855,6 +860,9 @@ class CommandorPage {
case OCRResult.TERMINAED: case OCRResult.TERMINAED:
this.isTerminated = true; this.isTerminated = true;
break; break;
case OCRResult.SLIDING_CAPTCHA_REFRESH:
await this.connect_to_browser(checkResult)
break;
case OCRResult.FILL_FIELD: case OCRResult.FILL_FIELD:
// console.log("browser.isConnected: " + this.browser.isConnected()); // console.log("browser.isConnected: " + this.browser.isConnected());
if (this.browser === undefined || !this.browser.isConnected()) { if (this.browser === undefined || !this.browser.isConnected()) {
@@ -1170,7 +1178,7 @@ class CommandorPage {
} }
async enableDisableAirPlanMode() { async enableDisableAirPlanMode() {
logWithDevice("will enable airplane mode", this.device) logWithDevice("will enable/disable airplane mode", this.device)
try { try {
await this.device.shell("cmd connectivity airplane-mode enable") await this.device.shell("cmd connectivity airplane-mode enable")
// await this.device.shell("adb shell settings put global airplane_mode_on 1") // await this.device.shell("adb shell settings put global airplane_mode_on 1")
@@ -1179,7 +1187,11 @@ class CommandorPage {
await this.device.shell("cmd connectivity airplane-mode disable") await this.device.shell("cmd connectivity airplane-mode disable")
await delay(2000) await delay(2000)
} catch (e) { } catch (e) {
try {
await this.device.shell("cmd connectivity airplane-mode disable") await this.device.shell("cmd connectivity airplane-mode disable")
} catch (e) {
console.log(e)
}
console.log(e) console.log(e)
} }
} }
+3
View File
@@ -111,6 +111,8 @@ class OCRChecker {
} else if (result.includes(CHECKING_MSG_FR) || result.includes(CHECKING_MSG_FR_2)) { } else if (result.includes(CHECKING_MSG_FR) || result.includes(CHECKING_MSG_FR_2)) {
return OCRResult.RECHECK return OCRResult.RECHECK
} else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3) || result.includes(SLIDING_CAPTCHA_FR_4)) { } else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3) || result.includes(SLIDING_CAPTCHA_FR_4)) {
// if (result.includes("rac"))
// return OCRResult.SLIDING_CAPTCHA_REFRESH
return OCRResult.SLIDING_CAPTCHA return OCRResult.SLIDING_CAPTCHA
} else if (result.includes(WELCOME_MESSAGE_FR)) { } else if (result.includes(WELCOME_MESSAGE_FR)) {
return OCRResult.NEED_TO_CLICK_LATE_BTN return OCRResult.NEED_TO_CLICK_LATE_BTN
@@ -175,6 +177,7 @@ class OCRChecker {
async take_screen_shot() { async take_screen_shot() {
let name = this.get_file_name() let name = this.get_file_name()
console.log("will take screenshot for " + this.device.model() + ":" + this.device.serial())
await this.device.screenshot({path: name}); await this.device.screenshot({path: name});
await delay(3000); await delay(3000);
return name return name