From 01ae5d904ebeccfd6a1bb51417368a81dd5f2985 Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Thu, 15 Sep 2022 11:33:58 +0200 Subject: [PATCH 1/3] add vivo --- clear_data.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clear_data.sh b/clear_data.sh index 7695911..485417d 100644 --- a/clear_data.sh +++ b/clear_data.sh @@ -36,3 +36,7 @@ adb -s 835dca3e shell am start -n com.android.chrome/com.google.android.apps.chr adb -s d54e946 shell pm clear com.android.chrome adb -s d54e946 shell am set-debug-app --persistent com.android.chrome adb -s d54e946 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main +#vivo tab +adb -s 926f2061 shell pm clear com.android.chrome +adb -s 926f2061 shell am set-debug-app --persistent com.android.chrome +adb -s 926f2061 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main From 679d690f93101d07199cb2478fedc3941d463ae7 Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Thu, 15 Sep 2022 11:37:01 +0200 Subject: [PATCH 2/3] add english support for mail --- src/workers/CommandorPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index f2bdc7e..7a919b4 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -23,6 +23,7 @@ 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 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 DOUBLE_REQUEST_ERROR_MESSAGE = "A request with the same data has already been validated today." const DOUBLE_REQUEST_ERROR_MESSAGE_FR = "Une demande avec les données saisies a déjà été validée aujourd’hui." const TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests" @@ -284,7 +285,7 @@ class CommandorPage { if (this.isFillingFields) await this.getErrors() } else { - if (content.includes(MESSAGE_URL_VALIDATION_FR)) { + if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) { console.log("successful"); await this.push_message_to_queue(PublishType.SUCCESS); } else { From 47fecec58ffe8c815335eb1e197d7acd66157ea8 Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Thu, 15 Sep 2022 18:52:49 +0200 Subject: [PATCH 3/3] avoid crash when field not found --- src/workers/CommandorPage.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 7a919b4..0127c47 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -146,12 +146,10 @@ class CommandorPage { } async inputName(page) { - await page.locator(LAST_NAME).focus() - await delay(getRandomWaitTime()) try { - - if (!page.isClosed()) { + await page.locator(LAST_NAME).focus() + await delay(getRandomWaitTime()) await page.locator(LAST_NAME).fill(this.contact.lastName) await page.locator(FIRST_NAME).focus() await delay(getRandomWaitTime()) @@ -257,7 +255,9 @@ class CommandorPage { try { if (!page.isClosed()) { page.evaluate((solution) => { - document.getElementById("g-recaptcha-response").innerHTML = solution; + let element = document.getElementById("g-recaptcha-response"); + if (element != null) + document.getElementById("g-recaptcha-response").innerHTML = solution; }, solution) this.clickValid(); }