diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index b1791cf..ca7ba74 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -111,6 +111,11 @@ class CommandorPage { // get url and push to server await this.fillFields() break; + case OCRResult.SLIDING_CAPTCHA_REFRESH: + pages.forEach((currentPage) => { + currentPage.close() + }) + break; case OCRResult.TO_REFRESH: logWithDevice("will reload page", this.device) let cmd = "input swipe 382 682 382 1682" @@ -855,6 +860,9 @@ class CommandorPage { case OCRResult.TERMINAED: this.isTerminated = true; break; + case OCRResult.SLIDING_CAPTCHA_REFRESH: + await this.connect_to_browser(checkResult) + break; case OCRResult.FILL_FIELD: // console.log("browser.isConnected: " + this.browser.isConnected()); if (this.browser === undefined || !this.browser.isConnected()) { @@ -1170,7 +1178,7 @@ class CommandorPage { } async enableDisableAirPlanMode() { - logWithDevice("will enable airplane mode", this.device) + logWithDevice("will enable/disable airplane mode", this.device) try { await this.device.shell("cmd connectivity airplane-mode enable") // 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 delay(2000) } catch (e) { - await this.device.shell("cmd connectivity airplane-mode disable") + try { + await this.device.shell("cmd connectivity airplane-mode disable") + } catch (e) { + console.log(e) + } console.log(e) } } diff --git a/src/workers/OCRChecker.js b/src/workers/OCRChecker.js index 9b638df..b342133 100644 --- a/src/workers/OCRChecker.js +++ b/src/workers/OCRChecker.js @@ -111,6 +111,8 @@ class OCRChecker { } else if (result.includes(CHECKING_MSG_FR) || result.includes(CHECKING_MSG_FR_2)) { 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)) { + // if (result.includes("rac")) + // return OCRResult.SLIDING_CAPTCHA_REFRESH return OCRResult.SLIDING_CAPTCHA } else if (result.includes(WELCOME_MESSAGE_FR)) { return OCRResult.NEED_TO_CLICK_LATE_BTN @@ -175,6 +177,7 @@ class OCRChecker { async take_screen_shot() { 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 delay(3000); return name