Merge branch 'master' into feature/scheduler
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const {exec} = require("child_process");
|
||||
const regexDevices = /[a-zA-Z0-9]/g
|
||||
exec("adb devices ", (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
// find the device id from output
|
||||
// let matchedDeviceIds = regexDevices.exec(stdout)
|
||||
regexDevices.global = true
|
||||
let matchedDeviceIds = stdout.matchAll(regexDevices);
|
||||
for (m in matchedDeviceIds) {
|
||||
console.log(m);
|
||||
}
|
||||
console.log(matchedDeviceIds)
|
||||
// var m;
|
||||
// do {
|
||||
// let m = regexDevices.exec(stdout);
|
||||
// if (m) {
|
||||
// console.log(m[1], m[2]);
|
||||
// }
|
||||
// } while (m);
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
const {_android: android} = require('playwright');
|
||||
const {exec} = require("child_process");
|
||||
|
||||
function delay(delayInMs) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(2);
|
||||
}, delayInMs);
|
||||
});
|
||||
}
|
||||
|
||||
android.devices().then((devices) => {
|
||||
devices.forEach((device) => {
|
||||
console.log(device.serial() + ":will reset browser");
|
||||
exec("adb -s " + device.serial() + " shell pm clear com.android.chrome", (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
});
|
||||
exec("adb -s " + device.serial() + " shell am set-debug-app --persistent com.android.chrome", (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
});
|
||||
exec("adb -s " + device.serial() + " shell am start -n com.android.chrome/com.google.android.apps.chrome.Main", (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
});
|
||||
})
|
||||
}
|
||||
)
|
||||
@@ -176,3 +176,92 @@ adb -s emulator-5556 shell am start -n com.android.chrome/com.google.android.app
|
||||
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 start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
#1
|
||||
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 start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#2
|
||||
adb -s 2890e299833f7ece shell pm clear com.android.chrome
|
||||
adb -s 2890e299833f7ece shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 2890e299833f7ece shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#3
|
||||
adb -s 2890e6d52b3f7ece shell pm clear com.android.chrome
|
||||
adb -s 2890e6d52b3f7ece shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 2890e6d52b3f7ece shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#4
|
||||
adb -s 3058394b4a393498 shell pm clear com.android.chrome
|
||||
adb -s 3058394b4a393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 3058394b4a393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#5
|
||||
adb -s 3131315531523098 shell pm clear com.android.chrome
|
||||
adb -s 3131315531523098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 3131315531523098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#6
|
||||
adb -s 324d414b4a393498 shell pm clear com.android.chrome
|
||||
adb -s 324d414b4a393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 324d414b4a393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#7
|
||||
adb -s 3452543639393498 shell pm clear com.android.chrome
|
||||
adb -s 3452543639393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 3452543639393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#8
|
||||
adb -s 34e8475c2e0b7ece shell pm clear com.android.chrome
|
||||
adb -s 34e8475c2e0b7ece shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 34e8475c2e0b7ece shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#9
|
||||
adb -s 364f55374c4c3098 shell pm clear com.android.chrome
|
||||
adb -s 364f55374c4c3098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 364f55374c4c3098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#10
|
||||
adb -s 374a4a4b4a393498 shell pm clear com.android.chrome
|
||||
adb -s 374a4a4b4a393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 374a4a4b4a393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#11
|
||||
adb -s 433954544a4a3098 shell pm clear com.android.chrome
|
||||
adb -s 433954544a4a3098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 433954544a4a3098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#12
|
||||
adb -s 4347394655383098 shell pm clear com.android.chrome
|
||||
adb -s 4347394655383098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 4347394655383098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#13
|
||||
adb -s 4448465253313498 shell pm clear com.android.chrome
|
||||
adb -s 4448465253313498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 4448465253313498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#14
|
||||
adb -s 4653345154303098 shell pm clear com.android.chrome
|
||||
adb -s 4653345154303098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 4653345154303098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#15
|
||||
adb -s 4b504b4b4a393498 shell pm clear com.android.chrome
|
||||
adb -s 4b504b4b4a393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 4b504b4b4a393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#16
|
||||
adb -s 53534a4b4a393498 shell pm clear com.android.chrome
|
||||
adb -s 53534a4b4a393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 53534a4b4a393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#17
|
||||
adb -s 5634563639393498 shell pm clear com.android.chrome
|
||||
adb -s 5634563639393498 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 5634563639393498 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
|
||||
#18
|
||||
adb -s 344d395044413098 shell pm clear com.android.chrome
|
||||
adb -s 344d395044413098 shell am set-debug-app --persistent com.android.chrome
|
||||
adb -s 344d395044413098 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||
@@ -0,0 +1 @@
|
||||
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
|
||||
+1
-1
@@ -141,7 +141,7 @@ async function scheduleBookWithNumbers(startNumber, endNumber, selectedStore, pa
|
||||
})
|
||||
}
|
||||
|
||||
async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = false, alertBeep = false) {
|
||||
async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx', audioAnalyse = true, alertBeep = false) {
|
||||
let allContactList = excelUtil.readContacts(pathToExcelFile);
|
||||
let contactList;
|
||||
if (endNumber <= allContactList.length) {
|
||||
|
||||
@@ -8,8 +8,6 @@ class ExcelUtil {
|
||||
let contactList = [];
|
||||
workSheetsFromFile[0].data.forEach(
|
||||
(info, index, list) => {
|
||||
// console.log("info:" + info)
|
||||
// console.log("index:" + index)
|
||||
if (index > 0 && info.length > 0) {
|
||||
// console.log(info)
|
||||
let name = info[0].split(" ")
|
||||
|
||||
@@ -9,8 +9,9 @@ const AUDIO_CAPTCHA_TRACK = ".audio-captcha-track";
|
||||
const CAPTCHA_CONTAINER = "#captcha-container";
|
||||
const WAV_URL_REGEX = "https:.+.wav";
|
||||
const re = new RegExp(WAV_URL_REGEX);
|
||||
// const SPEECH_TO_TEXT_HOST = "http://appointment.lpaconsulting.fr:8000"
|
||||
const SPEECH_TO_TEXT_HOST = "http://127.0.0.1:8000"
|
||||
const SPEECH_TO_TEXT_HOST = "http://appointment.lpaconsulting.fr:8000"
|
||||
|
||||
// const SPEECH_TO_TEXT_HOST = "http://127.0.0.1:8000"
|
||||
|
||||
function delay(delayInMs) {
|
||||
return new Promise(resolve => {
|
||||
@@ -66,6 +67,17 @@ class GeoCaptchaSolver {
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
async clearLastDigit(iframeHandler) {
|
||||
let selector = "#captcha__audio > div.audio-captcha-input-container > input:nth-child(" + 6 + ")"
|
||||
let lastDigit = await iframeHandler.locator(selector).inputValue()
|
||||
if (lastDigit !== "") {
|
||||
console.log(this.device.model() + ":last digit is not empty, clear it")
|
||||
await iframeHandler.locator(selector).fill("")
|
||||
} else {
|
||||
console.log(this.device.model() + ":last digit is empty, do nothing")
|
||||
}
|
||||
}
|
||||
|
||||
async solve(onResult) {
|
||||
console.log(this.device.model() + ":solve() called.")
|
||||
console.log(this.device.model() + ":play audio")
|
||||
@@ -89,6 +101,9 @@ class GeoCaptchaSolver {
|
||||
// console.log("selector is " + selector)
|
||||
try {
|
||||
await iframeHandler.locator(selector).focus()
|
||||
if (i === 5) {
|
||||
await this.clearLastDigit(iframeHandler)
|
||||
}
|
||||
await iframeHandler.locator(selector).fill("" + number_list[i - 1])
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@@ -100,7 +115,7 @@ class GeoCaptchaSolver {
|
||||
try {
|
||||
|
||||
let content = await captcha_container.innerHTML()
|
||||
console.log("inner container is " + content)
|
||||
console.log(this.device.model() + ":inner container is " + content)
|
||||
try {
|
||||
if (number_list.length === 0) {
|
||||
onResult(false)
|
||||
@@ -144,7 +159,7 @@ class GeoCaptchaSolver {
|
||||
}
|
||||
|
||||
async resetBrowser() {
|
||||
console.log("will reset browser")
|
||||
console.log(this.device.model() + ":will reset browser")
|
||||
await this.device.shell("pm clear com.android.chrome")
|
||||
await delay(1000)
|
||||
await this.device.shell("am set-debug-app --persistent com.android.chrome")
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
emulator -avd Pixel_0 &
|
||||
emulator -avd Pixel_1 &
|
||||
emulator -avd Pixel_2 &
|
||||
emulator -avd Pixel_3 &
|
||||
Reference in New Issue
Block a user