2 Commits

Author SHA1 Message Date
panleicim 703ca3d694 change include mode 2024-12-04 10:59:45 +01:00
panleicim 7cc4f87e0b stop when need to refresh captcha 2024-11-15 22:20:03 +01:00
5 changed files with 21 additions and 50 deletions
+4 -16
View File
@@ -1,10 +1,6 @@
const {exec} = require("child_process");
// DEVICE_REGEX = "(^[a-z0-9A-Z]*) .* model:([a-z0-9A-Z_]+)"
DEVICE_REGEX = "(^[a-z0-9A-Z-.:]*) .* model:([a-z0-9A-Z_]+)"
// DEVICE_REGEX = "(^[a-z0-9A-Z-]*) .* model:([a-z0-9A-Z_]+)"
DEVICE_REGEX = "(^[a-z0-9A-Z]*) .* model:([a-z0-9A-Z_]+)"
async function devices() {
return new Promise((resolve, reject) => {
@@ -28,10 +24,9 @@ async function devices() {
findResult = currentLine.match(DEVICE_REGEX)
console.log(findResult)
try{
result.push(new AndroidDevice(findResult[1], findResult[2]));
} catch (e) {
console.log(e)
}
result.push(new AndroidDevice(findResult[1], findResult[2]));}
catch(e){
console.log(e)}
console.log(result[i])
}
}
@@ -62,13 +57,6 @@ class AndroidDevice {
}
}
async clearApp(packageName) {
let cmd = `adb -s ${this.serial} shell pm clear ${packageName}`
console.log("cmd is " + cmd)
await exec(cmd);
}
shell(cmd) {
return new Promise((resolve, reject) => {
exec("adb -s " + this.serial + " shell " + cmd, (error, stdout, stderr) => {
+6 -6
View File
@@ -17,9 +17,9 @@ let includeMode = DeviceExcludeMode.ZERO
let three_to_include = []
let four_to_include = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518"]
let seven_to_excludes = ["4e8ca027", "hi7ljr5xduyt9pfi", "EPHUT20825001518", "bec11752", "fuljaueqguugf6pn", "EPHUT20825001518"]
let appointment_to_include = ["bec11752", "07fbd156", "71a0371d", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "ZY32GLBN5P", "ZY32GVW4NC", "becb6e99", "b41c1b72"]
// let appointment_to_include = ["ai9xv8hy599hvkee", "07fbd156", "71a0371d", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "fy65eqs4wkvcpf9h", "p7d6nbw8cu7duous", "fuljaueqguugf6pn", "fmiz5pa6rsx4u4ts"]
let appointment_to_include = ["ai9xv8hy599hvkee", "07fbd156", "71a0371d", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "fy65eqs4wkvcpf9h", "p7d6nbw8cu7duous", "fmiz5pa6rsx4u4ts"]
let nine_to_include = ["bec11752", "4e8ca027", "hi7ljr5xduyt9pfi", "47e7e36b", "p7d6nbw8cu7duous", "njzxojhim7gedyvw", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "EPHUT20825001518"]
let for_scrpay = ["07fbd156", "47e7e36b", "4f55c3d4", "5ac879a2", "69db59f0", "71a0371d", "774687ff", "7b71fb20", "8f76f9e7", "99cyfiaebqcy6poj", "EPHUT20825001518", "J4AXB761H2322WJ", "W8GMFELRHIKZS84T", "ai9xv8hy599hvkee", "b41c1b72", "bec11752", "becb6e99", "c3ba032e", "d54e946", "fmiz5pa6rsx4u4ts", "fuljaueqguugf6pn", "fy65eqs4wkvcpf9h", "hi7ljr5xduyt9pfi", "njzxojhim7gedyvw", "p7d6nbw8cu7duous"]
attributedPorts = []
const device_port_info = new Map();
startPort = 9000
@@ -129,8 +129,6 @@ function getContactListForDevice(device, allContactList) {
}
async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = true, alertBeep = false) {
console.log("startBookWithNumbers() called, with alertBeep:" + alertBeep)
console.log("startBookWithNumbers() called, with audioAnalyse:" + audioAnalyse)
let allContactList = excelUtil.readContacts(pathToExcelFile);
let contactList;
if (endNumber <= allContactList.length) {
@@ -156,7 +154,7 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
} else {
attributedPort = startPort;
startPort++;
let cmd = 'adb -s \"' + device.serial + "\" forward tcp:" + attributedPort + " localabstract:chrome_devtools_remote";
let cmd = 'adb -s ' + device.serial + " forward tcp:" + attributedPort + " localabstract:chrome_devtools_remote";
console.log("cmd is " + cmd);
const output = execSync(cmd, {encoding: 'utf-8'}); // the default is 'buffer'
console.log('Output was:\n', output);
@@ -194,10 +192,12 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
} else if (includeMode === DeviceExcludeMode.ZERO) {
device_to_excludes = []
}
let filteredDeviceList;
if (includeMode === DeviceExcludeMode.ZERO) {
filteredDeviceList = devices
} else
} else {
filteredDeviceList = devices.filter(device => device_to_excludes.includes(device.serial))
}
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
console.log("connected device number:" + filteredDeviceList.length)
console.log("segmentNumber:" + segmentNumber)
-1
View File
@@ -21,7 +21,6 @@ const OCRResult = {
RECAPTCHA_FAILED: Symbol("RECAPTCHA_FAILED"),
RECAPTCHA_ERROR: Symbol("RECAPTCHA_ERROR"),
NO_INTERNET: Symbol("NO_INTERNET"),
CHROME_NOTIFICATION: Symbol("CHROME_NOTIFICATION"),
BRAVE_SKIP: Symbol("BRAVE_SKIP"),
BRAVE_PRIVACY: Symbol("BRAVE_PRIVACY"),
BRAVE_PRIVACY_PUB: Symbol("BRAVE_PRIVACY_PUB"),
+10 -19
View File
@@ -11,6 +11,7 @@ const {exec} = require("child_process");
const {openUrlWithAdb} = require("../utiles/CmdUtils");
const RequestDataPojo = require("../models/RequestDataPojo");
const {REQUEST_DATA_OBJECT, TEST_QUEUE} = require("../queue/Sender");
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
const BLANK_URL = "about:blank"
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
@@ -57,6 +58,12 @@ function log(message) {
appointmentLogger.log({level: "info", message: message})
}
async function clearApp(device, packageName) {
let cmd = `adb -s ${device.serial} shell pm clear ${packageName}`
logWithDevice("cmd is " + cmd, device)
await exec(cmd);
}
async function exceutShellCmd(device, cmdToExecut) {
let cmd = `adb -s ${device.serial} shell ${cmdToExecut}`
logWithDevice("cmd is " + cmd, device)
@@ -820,11 +827,11 @@ class CommandorPage {
this.isCountryChoosen = false;
this.isPhoneInput = false;
this.isPasspordInput = false;
await this.device.clearApp(this.browserPackageName)
// await clearApp(this.device, this.browserPackageName)
await clearApp(this.device, this.browserPackageName)
// await this.device.shell("pm clear " + this.browserPackageName)
await delay(1000)
this.isTerminated = true;
// await this.checkResultWithOcr();
}
@@ -879,11 +886,7 @@ class CommandorPage {
this.isTerminated = true;
break;
case OCRResult.SLIDING_CAPTCHA_REFRESH:
await this.connect_to_browser(checkResult)
break;
case OCRResult.CHROME_NOTIFICATION:
await this.handleChromeNotification()
await this.checkResultWithOcr();
this.isTerminated = true;
break;
case OCRResult.SLIDING_CAPTCHA:
logWithDevice("will call this.slidingCaptcha()", this.device)
@@ -1445,8 +1448,6 @@ class CommandorPage {
this.device.shell("input tap " + 490 + " " + 1910)
} else if (model === "RMX3151") {
this.device.shell("input tap " + 492 + " " + 1960)
} else if (model === "Pixel"||model === "Pixel_2") {
this.device.shell("input tap " + 312 + " " + 1490)
} else if (model === "Mi Note 10") {
this.device.shell("input tap " + 550 + " " + 1920)
} else if (model === "ONEPLUS_A6000") {
@@ -1544,16 +1545,6 @@ class CommandorPage {
await this.tapForDevice(this.device, 100, 400)
}
async handleChromeNotification() {
let model = this.device.model
if (model === "KB2003" || model === "22041219PG" || model === "DE2117" || model === "21091116C") {
await this.tapForDevice(this.device, 545, 1448)
} else if (model === "sdk_gphone64_arm64") {
await this.tapForDevice(this.device, 484, 1723)
} else
await this.tapForDevice(this.device, 100, 400)
}
}
module
-7
View File
@@ -60,7 +60,6 @@ const PAGE_OPTIMIZATION_CHROME_FR_4 = "de nouvelles fonctionnalités"
const PAGE_OPTIMIZATION_CHROME_FR_5 = "Avec la mesure des performance"
const PAGE_OPTIMIZATION_CHROME_FR_7 = "Les annonces suggérées par les"
const PAGE_OPTIMIZATION_CHROME_FR_8 = "Chrome estime vos centres"
const CHROME_NOTIFICATION = "Les notifications de Chrome"
const ONLINE_APPOINTMENT = "Online Appointment"
const CONFIRM_RESEND_FORM_FR = "Confirmer le nouvel envoi"
const CLOSED_MESSAGE_FR = "Depuis plus de 130 ans"
@@ -110,9 +109,6 @@ class OCRChecker {
} else if (result.includes(PUSH_NOTIFICATION_1)) {
await this.deleteFile(fileName)
return OCRResult.BRAVE_PUSH_NOTIFICATION
} else if (result.includes(CHROME_NOTIFICATION)) {
await this.deleteFile(fileName)
return OCRResult.CHROME_NOTIFICATION
} else if (result.includes(CHOOSE_POSITION_GOOGLE_FR)) {
await this.deleteFile(fileName)
return OCRResult.CHOOSE_POSITION
@@ -152,9 +148,6 @@ class OCRChecker {
} else {
await this.deleteFile(fileName)
}
// await this.deleteFile(screenShot)
// if (result.includes("rac"))
// return OCRResult.SLIDING_CAPTCHA_REFRESH
return OCRResult.SLIDING_CAPTCHA
} else if (result.includes(SLIDING_CAPTCHA_RETRY_FR)
) {