change timeout to 4 mins
This commit is contained in:
@@ -7,3 +7,9 @@ adb -s J4AXB761H2322WJ shell am start -n com.android.chrome/com.google.android.a
|
|||||||
adb -s e30eb015 shell pm clear com.android.chrome
|
adb -s e30eb015 shell pm clear com.android.chrome
|
||||||
adb -s e30eb015 shell am set-debug-app --persistent com.android.chrome
|
adb -s e30eb015 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s e30eb015 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s e30eb015 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
adb -s 07f9c883 shell pm clear com.android.chrome
|
||||||
|
adb -s 07f9c883 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s 07f9c883 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
adb -s 76a3ac8d shell pm clear com.android.chrome
|
||||||
|
adb -s 76a3ac8d shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s 76a3ac8d shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
@@ -4,9 +4,10 @@ const SolveCaptcha = require("./SolveCaptcha");
|
|||||||
const ReserveResultPojo = require("../models/ReserveResultPojo");
|
const ReserveResultPojo = require("../models/ReserveResultPojo");
|
||||||
const PublishType = require("../models/PublishType");
|
const PublishType = require("../models/PublishType");
|
||||||
|
|
||||||
const RDV_URL = "http://192.168.1.16:8000/test_appointment.html"
|
// const RDV_URL = "http://192.168.1.16:8000/test_appointment.html"
|
||||||
// const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
|
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
|
||||||
BLANK_URL = "about:blank"
|
BLANK_URL = "about:blank"
|
||||||
|
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
|
||||||
|
|
||||||
const COUNTRY_ID = "#phone_country"
|
const COUNTRY_ID = "#phone_country"
|
||||||
const PHONE_NUMBER = "#phone_number"
|
const PHONE_NUMBER = "#phone_number"
|
||||||
@@ -18,7 +19,7 @@ const CGU_ID = "#cgu"
|
|||||||
const PROCESSING_ID = "#processing"
|
const PROCESSING_ID = "#processing"
|
||||||
const PASSPORT_ID = "#passport_id"
|
const PASSPORT_ID = "#passport_id"
|
||||||
|
|
||||||
const TIME_OUT = 60 * 1000 * 10//10mins
|
const TIME_OUT = 60 * 1000 * 4//4 mins
|
||||||
|
|
||||||
const CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
|
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 CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
|
||||||
@@ -72,7 +73,12 @@ class CommandorPage {
|
|||||||
this.page.on("response", (response) => {
|
this.page.on("response", (response) => {
|
||||||
this.onResponse(response)
|
this.onResponse(response)
|
||||||
})
|
})
|
||||||
await this.page.goto(RDV_URL, {timeout: 90 * 1000});
|
try {
|
||||||
|
await this.page.goto(RDV_URL, {timeout: 90 * 1000});
|
||||||
|
}catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
this.isTerminated = true
|
||||||
|
}
|
||||||
//wait 10 mins
|
//wait 10 mins
|
||||||
// Close the device.
|
// Close the device.
|
||||||
|
|
||||||
@@ -190,10 +196,14 @@ class CommandorPage {
|
|||||||
this.captchaSolver = new SolveCaptcha(page);
|
this.captchaSolver = new SolveCaptcha(page);
|
||||||
await this.captchaSolver.start((solution) => {
|
await this.captchaSolver.start((solution) => {
|
||||||
console.log("solution is: " + solution);
|
console.log("solution is: " + solution);
|
||||||
|
if (solution !== ERROR_CAPTCHA_UNSOLVABLE){
|
||||||
page.evaluate((solution) => {
|
page.evaluate((solution) => {
|
||||||
document.getElementById("g-recaptcha-response").innerHTML = solution;
|
document.getElementById("g-recaptcha-response").innerHTML = solution;
|
||||||
}, solution)
|
}, solution)
|
||||||
this.clickValid();
|
this.clickValid();}
|
||||||
|
else{
|
||||||
|
this.isTerminated = true;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,11 +212,13 @@ class CommandorPage {
|
|||||||
let captcha_url = "geo.captcha-delivery.com/captcha";
|
let captcha_url = "geo.captcha-delivery.com/captcha";
|
||||||
|
|
||||||
if (content.toString().includes(captcha_url)) {
|
if (content.toString().includes(captcha_url)) {
|
||||||
this.checkAudioBtn();
|
await this.checkAudioBtn();
|
||||||
console.log("we are blocked");
|
console.log("we are blocked");
|
||||||
} else {
|
} else {
|
||||||
if (currentPage.url() === RDV_URL) {
|
if (currentPage.url() === RDV_URL) {
|
||||||
await this.fillFields(this.page);
|
await this.fillFields(this.page);
|
||||||
|
if (this.isFillingFields)
|
||||||
|
this.getErrors()
|
||||||
} else {
|
} else {
|
||||||
if (content.includes(MESSAGE_URL_VALIDATION_FR)) {
|
if (content.includes(MESSAGE_URL_VALIDATION_FR)) {
|
||||||
console.log("successful");
|
console.log("successful");
|
||||||
@@ -219,14 +231,14 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAudioBtn() {
|
async checkAudioBtn() {
|
||||||
let iframe = this.page.querySelector("iframe").contentFrame();
|
// let iframe = await this.page.locator("iframe").contentFrame;
|
||||||
let audioBtn = iframe.querySelector("#captcha__audio__button");
|
// let audioBtn = iframe.locator("#captcha__audio__button");
|
||||||
if (audioBtn) {
|
// if (audioBtn) {
|
||||||
console.log("audioBtn found")
|
// console.log("audioBtn found")
|
||||||
} else {
|
// } else {
|
||||||
console.log("audioBtn not found")
|
// console.log("audioBtn not found")
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
async onResponse(response) {
|
async onResponse(response) {
|
||||||
|
|||||||
Reference in New Issue
Block a user