try catch
This commit is contained in:
@@ -769,20 +769,25 @@ class CommandorPage {
|
||||
} else {
|
||||
logWithDevice("this.browser.isConnected() is " + this.browser.isConnected(), this.device)
|
||||
if (this.browser.isConnected()) {
|
||||
let pages = await this.browser.pages();
|
||||
logWithDevice("get pages", this.device)
|
||||
try {
|
||||
let pages = await this.browser.pages();
|
||||
logWithDevice("get pages", this.device)
|
||||
pages.forEach((currentPage) => {
|
||||
if (currentPage.url() === RDV_URL) {
|
||||
this.page = currentPage;
|
||||
}
|
||||
})
|
||||
logWithDevice("this.page.bringToFront();", this.device)
|
||||
await this.page.bringToFront();
|
||||
// this.page = pages;
|
||||
// this.page.await
|
||||
await this.fillFields(this.page)
|
||||
await delay(2 * 1000);
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
this.isTerminated = true
|
||||
}
|
||||
|
||||
pages.forEach((currentPage) => {
|
||||
if (currentPage.url() === RDV_URL) {
|
||||
this.page = currentPage;
|
||||
}
|
||||
})
|
||||
logWithDevice("this.page.bringToFront();", this.device)
|
||||
await this.page.bringToFront();
|
||||
// this.page = pages;
|
||||
// this.page.await
|
||||
await this.fillFields(this.page)
|
||||
await delay(2 * 1000);
|
||||
}
|
||||
}
|
||||
// if (!this.browser.isConnected()) {
|
||||
|
||||
@@ -26,6 +26,9 @@ const BLOCKED_MSG_EN = "have been blocked"
|
||||
const BLOCKED_MSG_FR = "avez été bloqué"
|
||||
const CHECKING_MSG_FR = "Verifying"
|
||||
const ERR_CACHE_MISS = "ERR_CACHE_MISS"
|
||||
const ERR_CACHE_MISS_2 = "ERR_CACHE-MISS"
|
||||
const ERR_CACHE_MISS_3 = "appuyer sur le bouton d'actualisation"
|
||||
const ERR_CACHE_MISS_4 = "renvoyer les données"
|
||||
const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification"
|
||||
const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour"
|
||||
const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome"
|
||||
@@ -74,7 +77,7 @@ class OCRChecker {
|
||||
return OCRResult.RECAPTCHA_ERROR
|
||||
} else if (result.includes(BLOCKED_MSG_EN) || result.includes(BLOCKED_MSG_FR)) {
|
||||
return OCRResult.BLOCKED
|
||||
} else if (result.includes(ERR_CACHE_MISS)) {
|
||||
} 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
|
||||
} else if (result.includes(CHECKING_MSG_FR)) {
|
||||
return OCRResult.RECHECK
|
||||
|
||||
Reference in New Issue
Block a user