add NO_INTERNET option
This commit is contained in:
@@ -15,5 +15,6 @@ const OCRResult = {
|
|||||||
TO_SKIP: Symbol("TO_SKIP"),
|
TO_SKIP: Symbol("TO_SKIP"),
|
||||||
RECAPTCHA_FAILED: Symbol("RECAPTCHA_FAILED"),
|
RECAPTCHA_FAILED: Symbol("RECAPTCHA_FAILED"),
|
||||||
RECAPTCHA_ERROR: Symbol("RECAPTCHA_ERROR"),
|
RECAPTCHA_ERROR: Symbol("RECAPTCHA_ERROR"),
|
||||||
|
NO_INTERNET: Symbol("NO_INTERNET"),
|
||||||
}
|
}
|
||||||
module.exports = OCRResult
|
module.exports = OCRResult
|
||||||
@@ -501,6 +501,7 @@ class CommandorPage {
|
|||||||
// remove debug flag
|
// remove debug flag
|
||||||
// const validElement = await page.$('.btn');
|
// const validElement = await page.$('.btn');
|
||||||
console.log("will click on valid button");
|
console.log("will click on valid button");
|
||||||
|
console.log("isTerminated is " + this.isTerminated);
|
||||||
if (!this.isTerminated) {
|
if (!this.isTerminated) {
|
||||||
await this.page.evaluate(() => {
|
await this.page.evaluate(() => {
|
||||||
document.getElementsByClassName("btn")[0].click();
|
document.getElementsByClassName("btn")[0].click();
|
||||||
@@ -758,7 +759,7 @@ class CommandorPage {
|
|||||||
await delay(2000);
|
await delay(2000);
|
||||||
let checkResult = await this.ocrChecker.get_result();
|
let checkResult = await this.ocrChecker.get_result();
|
||||||
console.log(checkResult);
|
console.log(checkResult);
|
||||||
while (checkResult === OCRResult.RECHECK) {
|
while (checkResult === OCRResult.RECHECK || checkResult === OCRResult.NO_INTERNET) {
|
||||||
logWithDevice("will recheck OCR", this.device)
|
logWithDevice("will recheck OCR", this.device)
|
||||||
await delay(4000)
|
await delay(4000)
|
||||||
logWithDevice("will recheck OCR", this.device)
|
logWithDevice("will recheck OCR", this.device)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const config = {
|
|||||||
oem: 1,
|
oem: 1,
|
||||||
psm: 3,
|
psm: 3,
|
||||||
}
|
}
|
||||||
|
const NO_INTERNET_FR = "Aucun accés a Internet"
|
||||||
const MESSAGE_URL_VALIDATION_FR = "envoyé un lien par e-mail."
|
const MESSAGE_URL_VALIDATION_FR = "envoyé un lien par e-mail."
|
||||||
const MESSAGE_URL_VALIDATION_FR_2 = "un lien par e-mail"
|
const MESSAGE_URL_VALIDATION_FR_2 = "un lien par e-mail"
|
||||||
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
||||||
@@ -114,6 +114,8 @@ class OCRChecker {
|
|||||||
return OCRResult.TO_SKIP
|
return OCRResult.TO_SKIP
|
||||||
} else if (result.includes(RECAPTCHA_FAILED_FR)) {
|
} else if (result.includes(RECAPTCHA_FAILED_FR)) {
|
||||||
return OCRResult.TERMINAED
|
return OCRResult.TERMINAED
|
||||||
|
}else if (result.includes(NO_INTERNET_FR)) {
|
||||||
|
return OCRResult.NO_INTERNET
|
||||||
} else {
|
} else {
|
||||||
return OCRResult.TERMINAED
|
return OCRResult.TERMINAED
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user