support chrome
This commit is contained in:
@@ -397,7 +397,7 @@ class CommandorPage {
|
|||||||
logWithDevice("input name called with this.isNameInput=" + this.isNameInput, this.device)
|
logWithDevice("input name called with this.isNameInput=" + this.isNameInput, this.device)
|
||||||
if (this.browser.isConnected() && !this.isTerminated && !this.page.isClosed()) {
|
if (this.browser.isConnected() && !this.isTerminated && !this.page.isClosed()) {
|
||||||
if (!this.isNameInput) {
|
if (!this.isNameInput) {
|
||||||
await page.focus(LAST_NAME);
|
// await page.focus(LAST_NAME);
|
||||||
await delay(getRandomWaitTime());
|
await delay(getRandomWaitTime());
|
||||||
console.log("will clear surname field");
|
console.log("will clear surname field");
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
@@ -886,10 +886,11 @@ class CommandorPage {
|
|||||||
checkResult = await this.ocrChecker.get_result();
|
checkResult = await this.ocrChecker.get_result();
|
||||||
// await this.checkResultWithOcr()
|
// await this.checkResultWithOcr()
|
||||||
} else {
|
} else {
|
||||||
if (checkResult === OCRResult.SLIDING_CAPTCHA) {
|
await this.checkResultWithOcr()
|
||||||
checkResult = OCRResult.TERMINAED
|
// if (checkResult === OCRResult.SLIDING_CAPTCHA) {
|
||||||
this.isTerminated = true
|
// checkResult = OCRResult.TERMINAED
|
||||||
}
|
// this.isTerminated = true
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await delay(10 * 1000)
|
await delay(10 * 1000)
|
||||||
@@ -922,6 +923,7 @@ class CommandorPage {
|
|||||||
// add listeners
|
// add listeners
|
||||||
let pages = await timeout(this.browser.pages(), 5 * 1000);
|
let pages = await timeout(this.browser.pages(), 5 * 1000);
|
||||||
pages.forEach((currentPage) => {
|
pages.forEach((currentPage) => {
|
||||||
|
logWithDevice("current url is " + currentPage.url(), this.device)
|
||||||
if (currentPage.url() === RDV_URL) {
|
if (currentPage.url() === RDV_URL) {
|
||||||
this.page = currentPage;
|
this.page = currentPage;
|
||||||
} else {
|
} else {
|
||||||
@@ -943,35 +945,6 @@ class CommandorPage {
|
|||||||
await this.resetBrowser()
|
await this.resetBrowser()
|
||||||
// this.isTerminated = true;
|
// this.isTerminated = true;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// for (const currentPage of pages) {
|
|
||||||
// if (currentPage.url() === RDV_URL) {
|
|
||||||
// logWithDevice("get content", this.device)
|
|
||||||
// let pageContent = await currentPage.content()
|
|
||||||
// logWithDevice("content:" + pageContent, this.device)
|
|
||||||
// if (!pageContent.includes("geo.captcha-delivery.com")) {
|
|
||||||
// this.page = currentPage;
|
|
||||||
// break
|
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// await currentPage.close()
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// await currentPage.close()
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// this.isTerminated = true;
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
@@ -982,6 +955,19 @@ class CommandorPage {
|
|||||||
if (this.browser.isConnected()) {
|
if (this.browser.isConnected()) {
|
||||||
logWithDevice("will use old page", this.device)
|
logWithDevice("will use old page", this.device)
|
||||||
logWithDevice("this.page.bringToFront();", this.device)
|
logWithDevice("this.page.bringToFront();", this.device)
|
||||||
|
let pages = await timeout(this.browser.pages(), 5 * 1000);
|
||||||
|
pages.forEach((currentPage) => {
|
||||||
|
if (currentPage.url() === RDV_URL) {
|
||||||
|
this.page = currentPage;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (!this.isTerminated)
|
||||||
|
currentPage.close()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
await this.page.bringToFront();
|
await this.page.bringToFront();
|
||||||
// this.page = pages;
|
// this.page = pages;
|
||||||
// this.page.await
|
// this.page.await
|
||||||
@@ -1092,6 +1078,7 @@ class CommandorPage {
|
|||||||
else
|
else
|
||||||
await this.device.shell("input tap " + 488 + " " + 1848)
|
await this.device.shell("input tap " + 488 + " " + 1848)
|
||||||
await delay(2000);
|
await delay(2000);
|
||||||
|
await this.checkResultWithOcr();
|
||||||
break;
|
break;
|
||||||
case
|
case
|
||||||
OCRResult.TO_REFRESH
|
OCRResult.TO_REFRESH
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ 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 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 WELCOME_MESSAGE_FR_2 = "Chrome Connectez-vous"
|
||||||
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"
|
||||||
const PAGE_OPTIMIZATION_CHROME_FR_2 = "Vous pouvez modifier vos options a tout moment"
|
const PAGE_OPTIMIZATION_CHROME_FR_2 = "Vous pouvez modifier vos options a tout moment"
|
||||||
@@ -149,7 +150,9 @@ class OCRChecker {
|
|||||||
// if (result.includes("rac"))
|
// if (result.includes("rac"))
|
||||||
// return OCRResult.SLIDING_CAPTCHA_REFRESH
|
// return OCRResult.SLIDING_CAPTCHA_REFRESH
|
||||||
return OCRResult.SLIDING_CAPTCHA
|
return OCRResult.SLIDING_CAPTCHA
|
||||||
} else if (result.includes(WELCOME_MESSAGE_FR)) {
|
} else if (result.includes(WELCOME_MESSAGE_FR)
|
||||||
|
|| result.includes(WELCOME_MESSAGE_FR_2)
|
||||||
|
) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user