add timeout for pages()
This commit is contained in:
@@ -721,7 +721,6 @@ class CommandorPage {
|
|||||||
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
|
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
|
||||||
await this.page.close();
|
await this.page.close();
|
||||||
// await this.deleteFromBlackList()
|
// await this.deleteFromBlackList()
|
||||||
// await this.resetBrowser()
|
|
||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,7 +750,7 @@ class CommandorPage {
|
|||||||
logWithDevice("resetBrowser", this.device);
|
logWithDevice("resetBrowser", this.device);
|
||||||
this.isFillingFields = false;
|
this.isFillingFields = false;
|
||||||
this.cguChecked = false;
|
this.cguChecked = false;
|
||||||
this.isNameInput = false;
|
this.isNameInputing = false;
|
||||||
this.isEmailFilled = false;
|
this.isEmailFilled = false;
|
||||||
this.isCountryChoosen = false;
|
this.isCountryChoosen = false;
|
||||||
this.isPhoneInput = false;
|
this.isPhoneInput = false;
|
||||||
@@ -805,16 +804,20 @@ class CommandorPage {
|
|||||||
checkResult = await this.ocrChecker.get_result();
|
checkResult = await this.ocrChecker.get_result();
|
||||||
}
|
}
|
||||||
while (checkResult === OCRResult.SLIDING_CAPTCHA) {
|
while (checkResult === OCRResult.SLIDING_CAPTCHA) {
|
||||||
|
logWithDevice("will call this.slidingCaptcha()", this.device)
|
||||||
await this.slidingCaptcha(async (isSuccessful) => {
|
await this.slidingCaptcha(async (isSuccessful) => {
|
||||||
logWithDevice("SLIDING_CAPTCHA result is " + isSuccessful, this.device)
|
logWithDevice("SLIDING_CAPTCHA result is " + isSuccessful, this.device)
|
||||||
|
console.log(checkResult);
|
||||||
if (isSuccessful) {
|
if (isSuccessful) {
|
||||||
await delay(5 * 1000)
|
await delay(5 * 1000)
|
||||||
checkResult = await this.ocrChecker.get_result();
|
// checkResult = await this.ocrChecker.get_result();
|
||||||
console.log(checkResult);
|
await this.checkResultWithOcr()
|
||||||
} else {
|
} else {
|
||||||
|
if (checkResult === OCRResult.SLIDING_CAPTCHA) {
|
||||||
checkResult = OCRResult.TERMINAED
|
checkResult = OCRResult.TERMINAED
|
||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
await delay(10 * 1000)
|
await delay(10 * 1000)
|
||||||
}
|
}
|
||||||
@@ -933,12 +936,7 @@ 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)
|
|
||||||
break;
|
break;
|
||||||
case
|
case
|
||||||
OCRResult.BRAVE_SKIP:
|
OCRResult.BRAVE_SKIP:
|
||||||
|
|||||||
@@ -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_3 = "Sans préféré"
|
||||||
const MESSAGE_FILL_FIELD_FR_4 = "Magasin 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_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 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"
|
||||||
@@ -108,7 +109,7 @@ class OCRChecker {
|
|||||||
} else if (result.includes(SSL_CERT_ERROR)) {
|
} else if (result.includes(SSL_CERT_ERROR)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.SSL_CERT_ERROR
|
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)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.FILL_FIELD
|
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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user