Merge branch 'master' into feature/gui

This commit is contained in:
2022-09-17 19:25:12 +02:00
3 changed files with 59 additions and 27 deletions
+24
View File
@@ -44,3 +44,27 @@ adb -s 926f2061 shell am start -n com.android.chrome/com.google.android.apps.chr
adb -s 751005221815 shell pm clear com.android.chrome
adb -s 751005221815 shell am set-debug-app --persistent com.android.chrome
adb -s 751005221815 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
#samsung J5 - 2016
adb -s 4f55c3d4 shell pm clear com.android.chrome
adb -s 4f55c3d4 shell am set-debug-app --persistent com.android.chrome
adb -s 4f55c3d4 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
#samsung J5 - 2016
adb -s 69db59f0 shell pm clear com.android.chrome
adb -s 69db59f0 shell am set-debug-app --persistent com.android.chrome
adb -s 69db59f0 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
#samsung J5 - 2016
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 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
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 start -n com.android.chrome/com.google.android.apps.chrome.Main
+1 -3
View File
@@ -4,9 +4,7 @@ const ContactPojo = require("../models/ContactPojo");
class ExcelUtil {
readContacts() {
let workSheetsFromFile = xlsx.parse('C:/Users/lei/Desktop/contact_all.xlsx');
console.log(workSheetsFromFile);
// return a list of contactPojo
let workSheetsFromFile = xlsx.parse('/Users/lpan/Desktop/contact_all.xlsx');
let contactList = [];
workSheetsFromFile[0].data.forEach(
(info, index, list) => {
+16 -6
View File
@@ -3,8 +3,8 @@ const ReserveResultPojo = require("../models/ReserveResultPojo");
const appointmentLogger = require("../utiles/LoggerUtils")
const PublishType = require("../models/PublishType");
const beep = require('beepbeep')
const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
// const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
BLANK_URL = "about:blank"
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
@@ -42,7 +42,7 @@ function delay(delayInms) {
}
function getRandom() {
return Math.floor(Math.random() * 5);
return Math.floor(Math.random() * 3);
}
function getRandomWaitTime() {
@@ -67,7 +67,7 @@ class CommandorPage {
async loadPage() {
// Connect to the device.
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();
// await context.clearCookies()
@@ -238,13 +238,19 @@ class CommandorPage {
try {
if (!this.page.isClosed()) {
this.page.evaluate(() => {
let element = document.getElementsByClassName("btn")[0];
if (typeof element !== 'undefined')
document.getElementsByClassName("btn")[0].focus();
})
await delay(getRandomWaitTime())
if (!this.page.isClosed()) {
try {
this.page.evaluate(() => {
document.getElementsByClassName("btn")[0].click();
})
} catch (e) {
console.log(e)
}
}
}
} catch (e) {
@@ -281,13 +287,14 @@ class CommandorPage {
}
async onPageLoad(currentPage) {
try {
let content = await currentPage.content();
let captcha_url = "geo.captcha-delivery.com/captcha";
if (content.toString().includes(captcha_url)) {
await this.checkAudioBtn();
beep(20)
log("发现datadome");
console.log("发现datadome");
} else {
if (currentPage.url() === RDV_URL) {
await this.fillFields(this.page);
@@ -295,7 +302,7 @@ class CommandorPage {
await this.getErrors()
} else {
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
log("successful");
console.log("successful");
await this.push_message_to_queue(PublishType.SUCCESS);
} else {
// try to get errors
@@ -303,6 +310,9 @@ class CommandorPage {
}
}
}
} catch (e) {
console.log(e)
}
}
async checkAudioBtn() {