use google
This commit is contained in:
@@ -21,11 +21,10 @@ const FIRST_NAME = "#name"
|
|||||||
const CGU_ID = "#cgu"
|
const CGU_ID = "#cgu"
|
||||||
const PROCESSING_ID = "#processing"
|
const PROCESSING_ID = "#processing"
|
||||||
const PASSPORT_ID = "#passport_id"
|
const PASSPORT_ID = "#passport_id"
|
||||||
|
const CAPTCHA_CONTAINER = "#captcha-container";
|
||||||
|
|
||||||
const TIME_OUT = 60 * 1000 * 4//4 mins
|
const TIME_OUT = 60 * 1000 * 4//4 mins
|
||||||
|
|
||||||
const CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
|
|
||||||
const CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
|
|
||||||
const EMPTY_RESPONSE_ERROR = "ERR_EMPTY_RESPONSE"
|
const EMPTY_RESPONSE_ERROR = "ERR_EMPTY_RESPONSE"
|
||||||
const MESSAGE_URL_VALIDATION_FR = "Nous avons envoyé un lien par e-mail."
|
const MESSAGE_URL_VALIDATION_FR = "Nous avons envoyé 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"
|
||||||
@@ -89,7 +88,10 @@ class CommandorPage {
|
|||||||
this.onResponse(response)
|
this.onResponse(response)
|
||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
await this.page.goto(RDV_URL, {timeout: 90 * 1000});
|
await this.page.goto("https://www.google.com/search?q=hemes+rdv", {timeout: 90 * 1000});
|
||||||
|
this.page.locator(':nth-match(:text("Online Appointment"), 1)').click()
|
||||||
|
// this.page.locator('h3:has-text("Online Appointment")').click()
|
||||||
|
// await this.page.goto(RDV_URL, {timeout: 90 * 1000});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e)
|
log(e)
|
||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
@@ -293,6 +295,14 @@ class CommandorPage {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isBlocked() {
|
||||||
|
let iframeHandler = await this.page.frameLocator("body > iframe");
|
||||||
|
let captcha_container = await iframeHandler.locator(CAPTCHA_CONTAINER)
|
||||||
|
let html = await captcha_container.innerHTML()
|
||||||
|
console.log("audio_tag: " + html);
|
||||||
|
return html.includes("You have been blocked")
|
||||||
|
}
|
||||||
|
|
||||||
async onPageLoad(currentPage) {
|
async onPageLoad(currentPage) {
|
||||||
try {
|
try {
|
||||||
let content = await currentPage.content();
|
let content = await currentPage.content();
|
||||||
@@ -332,8 +342,9 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async checkAudioBtn() {
|
async checkAudioBtn() {
|
||||||
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
|
let isBlocked = this.isBlocked()
|
||||||
if (audioBtn) {
|
if (!isBlocked) {
|
||||||
|
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
|
||||||
log("audioBtn found")
|
log("audioBtn found")
|
||||||
audioBtn.click()
|
audioBtn.click()
|
||||||
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
|
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
|
||||||
|
|||||||
Reference in New Issue
Block a user