more possibility

This commit is contained in:
Lei PAN
2023-07-19 19:10:45 +02:00
parent 0f0021e8c0
commit 5e69d68dde
2 changed files with 16 additions and 6 deletions
+8 -2
View File
@@ -838,13 +838,13 @@ class CommandorPage {
pages.forEach((currentPage) => { pages.forEach((currentPage) => {
if (currentPage.url() === RDV_URL) { if (currentPage.url() === RDV_URL) {
this.page = currentPage; this.page = currentPage;
} else {
currentPage.close()
} }
}) })
logWithDevice("this.page.bringToFront();", this.device) logWithDevice("this.page.bringToFront();", this.device)
await this.page.bringToFront(); await this.page.bringToFront();
// this.page = pages;
// this.page.await
await this.fillFields(this.page) await this.fillFields(this.page)
await delay(2 * 1000); await delay(2 * 1000);
} catch (e) { } catch (e) {
@@ -863,6 +863,8 @@ class CommandorPage {
pages.forEach((currentPage) => { pages.forEach((currentPage) => {
if (currentPage.url() === RDV_URL) { if (currentPage.url() === RDV_URL) {
this.page = currentPage; this.page = currentPage;
} else {
currentPage.close()
} }
}) })
logWithDevice("this.page.bringToFront();", this.device) logWithDevice("this.page.bringToFront();", this.device)
@@ -894,7 +896,11 @@ class CommandorPage {
break; break;
case case
OCRResult.RECAPTCHA_ERROR: OCRResult.RECAPTCHA_ERROR:
// if (!this.isFillingFields)
this.isTerminated = true; this.isTerminated = true;
// else {
// await this.checkResultWithOcr();
// }
// await this.connect_to_browser(OCRResult.RECAPTCHA_ERROR) // await this.connect_to_browser(OCRResult.RECAPTCHA_ERROR)
break; break;
case case
+8 -4
View File
@@ -24,6 +24,7 @@ const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué" const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
const BLOCKED_MSG_EN = "have been blocked" const BLOCKED_MSG_EN = "have been blocked"
const BLOCKED_MSG_FR = "avez été bloqué" const BLOCKED_MSG_FR = "avez été bloqué"
const BLOCKED_MSG_FR_2 = "Pourquoi ce blocage"
const CHECKING_MSG_FR = "Verifying" const CHECKING_MSG_FR = "Verifying"
const ERR_CACHE_MISS = "ERR_CACHE_MISS" const ERR_CACHE_MISS = "ERR_CACHE_MISS"
const ERR_CACHE_MISS_2 = "ERR_CACHE-MISS" const ERR_CACHE_MISS_2 = "ERR_CACHE-MISS"
@@ -34,7 +35,10 @@ const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour"
const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle" const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle"
const SLIDING_CAPTCHA_FR_4 = " s'assure qu'on s'adresse bien" const SLIDING_CAPTCHA_FR_4 = " s'assure qu'on s'adresse bien"
const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour" const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour"
const MESSAGE_FILL_FIELD_FR_2 = "Lensemble des champs de données doivent étre complétés" const MESSAGE_FILL_FIELD_FR_2 = "des champs de données doivent étre complétés"
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 WELCOME_MESSAGE_FR = "Bienvenue dans Chrome" 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 = "Vous pouvez changer d'avis a tout moment dans"
const PAGE_OPTIMIZATION_CHROME_FR_6 = "Vous pouvez changer davis a tout moment" const PAGE_OPTIMIZATION_CHROME_FR_6 = "Vous pouvez changer davis a tout moment"
@@ -90,9 +94,11 @@ class OCRChecker {
console.log(result) console.log(result)
if (result.includes(MESSAGE_URL_VALIDATION_EN) || result.includes(MESSAGE_URL_VALIDATION_FR) || result.includes(MESSAGE_URL_VALIDATION_FR_2)) { if (result.includes(MESSAGE_URL_VALIDATION_EN) || result.includes(MESSAGE_URL_VALIDATION_FR) || result.includes(MESSAGE_URL_VALIDATION_FR_2)) {
return OCRResult.SUCCESS return OCRResult.SUCCESS
} 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)) {
return OCRResult.FILL_FIELD
} else if (result.includes(CAPTCHA_ERROR_MESSAGE) || result.includes(CAPTCHA_ERROR_MESSAGE_FR)) { } else if (result.includes(CAPTCHA_ERROR_MESSAGE) || result.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
return OCRResult.RECAPTCHA_ERROR return OCRResult.RECAPTCHA_ERROR
} else if (result.includes(BLOCKED_MSG_EN) || result.includes(BLOCKED_MSG_FR)) { } else if (result.includes(BLOCKED_MSG_EN) || result.includes(BLOCKED_MSG_FR) || result.includes(BLOCKED_MSG_FR_2)) {
return OCRResult.BLOCKED return OCRResult.BLOCKED
} else if (result.includes(ERR_CACHE_MISS) || result.includes(ERR_CACHE_MISS_2) || result.includes(ERR_CACHE_MISS_3) || result.includes(ERR_CACHE_MISS_4)) { } else if (result.includes(ERR_CACHE_MISS) || result.includes(ERR_CACHE_MISS_2) || result.includes(ERR_CACHE_MISS_3) || result.includes(ERR_CACHE_MISS_4)) {
return OCRResult.TO_REFRESH return OCRResult.TO_REFRESH
@@ -100,8 +106,6 @@ class OCRChecker {
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)) {
return OCRResult.SLIDING_CAPTCHA return OCRResult.SLIDING_CAPTCHA
} else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2)) {
return OCRResult.FILL_FIELD
} 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
} else if (result.includes(GOOGLE_DISCONNECT_FR) || result.includes(GOOGLE_DISCONNECT_FR_1)) { } else if (result.includes(GOOGLE_DISCONNECT_FR) || result.includes(GOOGLE_DISCONNECT_FR_1)) {