diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 94171f7..4f23b43 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -721,7 +721,6 @@ class CommandorPage { await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict()) await this.page.close(); // await this.deleteFromBlackList() - // await this.resetBrowser() this.isTerminated = true } @@ -751,7 +750,7 @@ class CommandorPage { logWithDevice("resetBrowser", this.device); this.isFillingFields = false; this.cguChecked = false; - this.isNameInput = false; + this.isNameInputing = false; this.isEmailFilled = false; this.isCountryChoosen = false; this.isPhoneInput = false; @@ -805,15 +804,19 @@ class CommandorPage { checkResult = await this.ocrChecker.get_result(); } while (checkResult === OCRResult.SLIDING_CAPTCHA) { + logWithDevice("will call this.slidingCaptcha()", this.device) await this.slidingCaptcha(async (isSuccessful) => { logWithDevice("SLIDING_CAPTCHA result is " + isSuccessful, this.device) + console.log(checkResult); if (isSuccessful) { await delay(5 * 1000) - checkResult = await this.ocrChecker.get_result(); - console.log(checkResult); + // checkResult = await this.ocrChecker.get_result(); + await this.checkResultWithOcr() } else { - checkResult = OCRResult.TERMINAED - this.isTerminated = true + if (checkResult === OCRResult.SLIDING_CAPTCHA) { + checkResult = OCRResult.TERMINAED + this.isTerminated = true + } } }) await delay(10 * 1000) @@ -933,12 +936,7 @@ class CommandorPage { break; case OCRResult.RECAPTCHA_ERROR: - // if (!this.isFillingFields) this.isTerminated = true; - // else { - // await this.checkResultWithOcr(); - // } - // await this.connect_to_browser(OCRResult.RECAPTCHA_ERROR) break; case OCRResult.BRAVE_SKIP: diff --git a/src/workers/OCRChecker.js b/src/workers/OCRChecker.js index 67f2c79..a699a5a 100644 --- a/src/workers/OCRChecker.js +++ b/src/workers/OCRChecker.js @@ -46,6 +46,7 @@ const MESSAGE_FILL_FIELD_FR_2 = "des champs de données doivent étre complété const MESSAGE_FILL_FIELD_FR_3 = "Sans préféré" const MESSAGE_FILL_FIELD_FR_4 = "Magasin préféré" const MESSAGE_FILL_FIELD_FR_5 = "email vous sera envoyé pour vous" +const MESSAGE_FILL_FIELD_FR_6 = "Prénom* Téléphone*" const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome" const PAGE_OPTIMIZATION_CHROME_FR = "Vous pouvez changer d'avis a tout moment dans" const PAGE_OPTIMIZATION_CHROME_FR_6 = "Vous pouvez changer davis a tout moment" @@ -108,7 +109,7 @@ class OCRChecker { } else if (result.includes(SSL_CERT_ERROR)) { await this.deleteFile(fileName) return OCRResult.SSL_CERT_ERROR - } else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2) || result.includes(MESSAGE_FILL_FIELD_FR_3) || result.includes(MESSAGE_FILL_FIELD_FR_4) || result.includes(MESSAGE_FILL_FIELD_FR_5)) { + } else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2) || result.includes(MESSAGE_FILL_FIELD_FR_3) || result.includes(MESSAGE_FILL_FIELD_FR_4) || result.includes(MESSAGE_FILL_FIELD_FR_5)||result.includes(MESSAGE_FILL_FIELD_FR_6)) { await this.deleteFile(fileName) return OCRResult.FILL_FIELD } else if (result.includes(CAPTCHA_ERROR_MESSAGE) || result.includes(CAPTCHA_ERROR_MESSAGE_FR)) {