set to random store and try catch
This commit is contained in:
@@ -192,17 +192,17 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async chooseStore(page) {
|
async chooseStore(page) {
|
||||||
try {
|
// try {
|
||||||
if (!page.isClosed()) {
|
// if (!page.isClosed()) {
|
||||||
await page.locator(PREFER_STORE).focus()
|
// await page.locator(PREFER_STORE).focus()
|
||||||
await delay(1000)
|
// await delay(1000)
|
||||||
await page.click(PREFER_STORE);
|
// await page.click(PREFER_STORE);
|
||||||
await page.selectOption(PREFER_STORE, "faubourg");
|
// await page.selectOption(PREFER_STORE, "faubourg");
|
||||||
}
|
// }
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
console.log(e);
|
// console.log(e);
|
||||||
this.isTerminated = true;
|
// this.isTerminated = true;
|
||||||
}
|
// }
|
||||||
// await page.click(PREFER_STORE);
|
// await page.click(PREFER_STORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,27 +272,33 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onPageLoad(currentPage) {
|
async onPageLoad(currentPage) {
|
||||||
let content = await currentPage.content();
|
try {
|
||||||
let captcha_url = "geo.captcha-delivery.com/captcha";
|
|
||||||
|
|
||||||
if (content.toString().includes(captcha_url)) {
|
|
||||||
await this.checkAudioBtn();
|
let content = await currentPage.content();
|
||||||
beep(20)
|
let captcha_url = "geo.captcha-delivery.com/captcha";
|
||||||
console.log("发现datadome");
|
|
||||||
} else {
|
if (content.toString().includes(captcha_url)) {
|
||||||
if (currentPage.url() === RDV_URL) {
|
await this.checkAudioBtn();
|
||||||
await this.fillFields(this.page);
|
beep(20)
|
||||||
if (this.isFillingFields)
|
console.log("发现datadome");
|
||||||
await this.getErrors()
|
|
||||||
} else {
|
} else {
|
||||||
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
|
if (currentPage.url() === RDV_URL) {
|
||||||
console.log("successful");
|
await this.fillFields(this.page);
|
||||||
await this.push_message_to_queue(PublishType.SUCCESS);
|
if (this.isFillingFields)
|
||||||
|
await this.getErrors()
|
||||||
} else {
|
} else {
|
||||||
// try to get errors
|
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
|
||||||
await this.getErrors()
|
console.log("successful");
|
||||||
|
await this.push_message_to_queue(PublishType.SUCCESS);
|
||||||
|
} else {
|
||||||
|
// try to get errors
|
||||||
|
await this.getErrors()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user