Merge branch 'master' into feature/test_accepted_contact
This commit is contained in:
@@ -247,6 +247,12 @@ adb -s APU7N16321020182 shell pm clear com.android.chrome
|
|||||||
adb -s APU7N16321020182 shell am set-debug-app --persistent com.android.chrome
|
adb -s APU7N16321020182 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s APU7N16321020182 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s APU7N16321020182 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
|
||||||
|
#huawei mate 8
|
||||||
|
adb -s emulator-5554 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5554 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5554 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
#1
|
#1
|
||||||
adb -s 2469c020930c7ece shell pm clear com.android.chrome
|
adb -s 2469c020930c7ece shell pm clear com.android.chrome
|
||||||
adb -s 2469c020930c7ece shell am set-debug-app --persistent com.android.chrome
|
adb -s 2469c020930c7ece shell am set-debug-app --persistent com.android.chrome
|
||||||
|
|||||||
+25
-8
@@ -4,9 +4,6 @@ adb -s RQ3005CA88 shell am start -n com.android.chrome/com.google.android.apps.c
|
|||||||
adb -s J4AXB761H2322WJ shell pm clear com.android.chrome
|
adb -s J4AXB761H2322WJ shell pm clear com.android.chrome
|
||||||
adb -s J4AXB761H2322WJ shell am set-debug-app --persistent com.android.chrome
|
adb -s J4AXB761H2322WJ shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s J4AXB761H2322WJ shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s J4AXB761H2322WJ shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
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 start -n com.android.chrome/com.google.android.apps.chrome.Main
|
|
||||||
adb -s 07f9c883 shell pm clear com.android.chrome
|
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 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 07f9c883 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
@@ -55,11 +52,6 @@ adb -s 6c3076e6 shell pm clear com.android.chrome
|
|||||||
adb -s 6c3076e6 shell am set-debug-app --persistent com.android.chrome
|
adb -s 6c3076e6 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s 6c3076e6 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s 6c3076e6 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
#samsung J5 - 2016
|
|
||||||
adb -s 774687ff shell pm clear com.android.chrome
|
|
||||||
adb -s 774687ff shell am set-debug-app --persistent com.android.chrome
|
|
||||||
adb -s 774687ff shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
|
||||||
|
|
||||||
#samsung J5 - 2016
|
#samsung J5 - 2016
|
||||||
adb -s ffa9b2bc shell pm clear com.android.chrome
|
adb -s ffa9b2bc shell pm clear com.android.chrome
|
||||||
adb -s ffa9b2bc shell am set-debug-app --persistent com.android.chrome
|
adb -s ffa9b2bc shell am set-debug-app --persistent com.android.chrome
|
||||||
@@ -291,3 +283,28 @@ adb -s 192.168.0.27:5555 shell am start -n com.android.chrome/com.google.android
|
|||||||
adb -s emulator-5560 shell pm clear com.android.chrome
|
adb -s emulator-5560 shell pm clear com.android.chrome
|
||||||
adb -s emulator-5560 shell am set-debug-app --persistent com.android.chrome
|
adb -s emulator-5560 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s emulator-5560 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s emulator-5560 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#18
|
||||||
|
adb -s emulator-5564 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5564 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5564 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#18
|
||||||
|
adb -s emulator-5566 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5566 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5566 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#18
|
||||||
|
adb -s emulator-5568 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5568 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5568 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#18
|
||||||
|
adb -s emulator-5570 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5570 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5570 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#18
|
||||||
|
adb -s emulator-5572 shell pm clear com.android.chrome
|
||||||
|
adb -s emulator-5572 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s emulator-5572 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
"node-schedule": "^2.1.0",
|
"node-schedule": "^2.1.0",
|
||||||
"node-wget": "^0.4.3",
|
"node-wget": "^0.4.3",
|
||||||
"node-xlsx": "^0.21.0",
|
"node-xlsx": "^0.21.0",
|
||||||
"playwright": "1.23.0",
|
"playwright": "^1.32.1",
|
||||||
"read-ini-file": "^3.0.1",
|
"read-ini-file": "^3.0.1",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"image-size": "^1.0.2",
|
"image-size": "^1.0.2",
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
|
|||||||
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
|
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
|
||||||
const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
|
const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
|
||||||
const DEFAULT_STORE = 'faubourg';
|
const DEFAULT_STORE = 'faubourg';
|
||||||
const searchTexts = ['hermes+rdv', 'hermes+rendezvous', 'hermes+appointment', 'hermes+appointment+online', 'appointment+hermes', 'hermes+rendez+vous', 'hermes+rendez+vous+paris', 'online+appointment+hermes', 'hermes+online+appointment', 'paris+hermes+online+appointment']
|
|
||||||
|
const searchTexts = ['hermes+rdv+online+paris', 'hermes+rdv+enligne+paris', 'hermes+rdv+en+ligne+paris', 'hermes+rendezvous+en+ligne+paris', 'hermes+appointment+online+paris', 'hermes+appointment+online+paris', 'appointment+hermes+paris+on+line', 'hermes+rendez+vous+online+paris', 'hermes+rendez+vous+paris+en+ligne', 'hermes+rendez+vous+paris+enligne', 'hermes+rendez+vous+paris+online', 'online+appointment+hermes+paris', 'hermes+online+appointment+paris', 'paris+hermes+online+appointment']
|
||||||
|
|
||||||
function delay(delayInMs) {
|
function delay(delayInMs) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@@ -82,11 +83,11 @@ class CommandorPage {
|
|||||||
// Connect to the device.
|
// Connect to the device.
|
||||||
log("loadPage() called");
|
log("loadPage() called");
|
||||||
// await this.device.shell('am force-stop com.android.chrome');
|
// await this.device.shell('am force-stop com.android.chrome');
|
||||||
const context = await this.device.launchBrowser();
|
try {
|
||||||
|
this.context = await this.device.launchBrowser();
|
||||||
// await context.clearCookies()
|
// await context.clearCookies()
|
||||||
|
|
||||||
// Use BrowserContext as usual.
|
// Use BrowserContext as usual.
|
||||||
this.page = await context.newPage();
|
this.page = await this.context.newPage();
|
||||||
this.page.on("load", (loadedPage) => {
|
this.page.on("load", (loadedPage) => {
|
||||||
this.onPageLoad(loadedPage)
|
this.onPageLoad(loadedPage)
|
||||||
})
|
})
|
||||||
@@ -94,6 +95,11 @@ class CommandorPage {
|
|||||||
this.page.on("response", (response) => {
|
this.page.on("response", (response) => {
|
||||||
this.onResponse(response)
|
this.onResponse(response)
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
log(e)
|
||||||
|
this.isTerminated = true
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const item = searchTexts[Math.floor(Math.random() * searchTexts.length)];
|
const item = searchTexts[Math.floor(Math.random() * searchTexts.length)];
|
||||||
await this.page.goto("https://www.google.com/search?q=" + item + "&lr=lang_en", {timeout: 90 * 1000});
|
await this.page.goto("https://www.google.com/search?q=" + item + "&lr=lang_en", {timeout: 90 * 1000});
|
||||||
@@ -104,17 +110,11 @@ class CommandorPage {
|
|||||||
try {
|
try {
|
||||||
if (this.page.url().includes("google"))
|
if (this.page.url().includes("google"))
|
||||||
this.page.locator('button >> nth=3').click()
|
this.page.locator('button >> nth=3').click()
|
||||||
// this.page.locator('button:has-text("Tout accepter")').click()
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e)
|
log(e)
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// this.page.locator('button:has-text("Accept all")').click()
|
|
||||||
// } catch (e) {
|
|
||||||
// log(e)
|
|
||||||
// }
|
|
||||||
try {
|
try {
|
||||||
this.page.locator(':nth-match(:text("Online Appointment"), 1)').click()
|
this.page.locator(':nth-match(:text("rendezvousparis"), 1)').click()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e)
|
log(e)
|
||||||
if (!this.page.url().includes(RDV_URL)) {
|
if (!this.page.url().includes(RDV_URL)) {
|
||||||
@@ -126,12 +126,18 @@ class CommandorPage {
|
|||||||
const intervalTask = setInterval(() => {
|
const intervalTask = setInterval(() => {
|
||||||
if (this.isTerminated) {
|
if (this.isTerminated) {
|
||||||
log(this.device.model() + ":request terminated, will close device");
|
log(this.device.model() + ":request terminated, will close device");
|
||||||
context.close();
|
if (this.context !== undefined)
|
||||||
|
this.context.close();
|
||||||
// this.page.close()
|
// this.page.close()
|
||||||
this.device.close()
|
// this.device.close()
|
||||||
clearInterval(intervalTask)
|
clearInterval(intervalTask)
|
||||||
cancel()
|
cancel()
|
||||||
return context
|
return this.context
|
||||||
|
} else {
|
||||||
|
if (this.page.url() === RDV_URL) {
|
||||||
|
if (!this.isFillingFields)
|
||||||
|
this.fillFields(this.page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 10 * 1000)//interval of 10 seconds
|
}, 10 * 1000)//interval of 10 seconds
|
||||||
|
|
||||||
@@ -314,6 +320,12 @@ class CommandorPage {
|
|||||||
await this.push_message_to_queue(PublishType.SUCCESS)
|
await this.push_message_to_queue(PublishType.SUCCESS)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//check whether there is captcha
|
||||||
|
let pageContent = await page.content()
|
||||||
|
let hasCaptcha = pageContent.includes("g-recaptcha-response")
|
||||||
|
if (hasCaptcha) {
|
||||||
|
await this.clickCheckbox()
|
||||||
|
await delay(1000)
|
||||||
this.captchaSolver = new SolveCaptcha(page);
|
this.captchaSolver = new SolveCaptcha(page);
|
||||||
await this.captchaSolver.start((solution) => {
|
await this.captchaSolver.start((solution) => {
|
||||||
log("solution is: " + solution);
|
log("solution is: " + solution);
|
||||||
@@ -335,6 +347,9 @@ class CommandorPage {
|
|||||||
this.isTerminated = true;
|
this.isTerminated = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
await this.clickValid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async isBlocked() {
|
async isBlocked() {
|
||||||
@@ -365,8 +380,8 @@ class CommandorPage {
|
|||||||
} 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)
|
// if (this.isFillingFields)
|
||||||
await this.getErrors()
|
// await this.getErrors()
|
||||||
} else {
|
} else {
|
||||||
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
|
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
|
||||||
log("successful");
|
log("successful");
|
||||||
@@ -385,6 +400,20 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async saveCookies() {
|
||||||
|
log("saveCookies() called.")
|
||||||
|
try {
|
||||||
|
let cookies = await this.page.context().cookies();
|
||||||
|
let cookiesInJson = [];
|
||||||
|
cookies.forEach((cookie) => {
|
||||||
|
cookiesInJson.push(JSON.stringify(cookie))
|
||||||
|
})
|
||||||
|
await require("fs").writeFileSync(this.contact.mail + '.txt', cookiesInJson.join('\n'));
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async checkAudioBtn() {
|
async checkAudioBtn() {
|
||||||
let isBlocked = await this.isBlocked()
|
let isBlocked = await this.isBlocked()
|
||||||
if (!isBlocked) {
|
if (!isBlocked) {
|
||||||
@@ -423,6 +452,8 @@ class CommandorPage {
|
|||||||
// log("onResponse with url:" + response.body())
|
// log("onResponse with url:" + response.body())
|
||||||
if (rex.test(response.url())) {
|
if (rex.test(response.url())) {
|
||||||
log("rdv url found:" + response.url())
|
log("rdv url found:" + response.url())
|
||||||
|
// save cookies
|
||||||
|
await this.saveCookies();
|
||||||
await this.push_message_to_db(PublishType.SUCCESS, response.url())
|
await this.push_message_to_db(PublishType.SUCCESS, response.url())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -473,6 +504,15 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async clickCheckbox() {
|
||||||
|
try {
|
||||||
|
// let errorItem = await this.page.click("#recaptcha-anchor > div.recaptcha-checkbox-border")
|
||||||
|
await this.page.frameLocator('[title="reCAPTCHA"]').getByRole('checkbox', {name: 'I\'m not a robot'}).click();
|
||||||
|
} catch (e) {
|
||||||
|
log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async handleError(errorContent) {
|
async handleError(errorContent) {
|
||||||
log("handle error:" + errorContent);
|
log("handle error:" + errorContent);
|
||||||
if (errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE) || errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE_FR)) {
|
if (errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE) || errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE_FR)) {
|
||||||
|
|||||||
+2
-2
@@ -8,5 +8,5 @@ emulator -avd Pixel_2_API_30_6 &
|
|||||||
emulator -avd Pixel_2_API_30_7 &
|
emulator -avd Pixel_2_API_30_7 &
|
||||||
emulator -avd Pixel_2_API_30_8 &
|
emulator -avd Pixel_2_API_30_8 &
|
||||||
emulator -avd Pixel_2_API_30_9 &
|
emulator -avd Pixel_2_API_30_9 &
|
||||||
emulator -avd Pixel_2_API_30_10 &
|
#emulator -avd Pixel_2_API_30_10 &
|
||||||
emulator -avd Pixel_2_API_30_11 &
|
#emulator -avd Pixel_2_API_30_11 &
|
||||||
Reference in New Issue
Block a user