test with touchscreen param

This commit is contained in:
Lei PAN
2023-07-17 23:28:28 +02:00
parent 6e11205f46
commit 2606ad362c
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -312,7 +312,6 @@ class CommandorPage {
async inputPhoneNumber(page) {
logWithDevice("inputPhoneNumber", this.device)
try {
if (this.browser.isConnected() && !this.isTerminated) {
if (!this.isPhoneInput) {
@@ -325,7 +324,7 @@ class CommandorPage {
}
})
await delay(1000);
await page.keyboard.type("0" + this.contact.phoneNumber);
await page.keyboard.type("+33 " + this.contact.phoneNumber);
this.isPhoneInput = true;
}
}
@@ -576,7 +575,7 @@ class CommandorPage {
let pageContent = await page.content()
let hasCaptcha = pageContent.includes("g-recaptcha-response")
if (hasCaptcha) {
// await this.clickCheckbox()
await this.clickCheckbox()
await delay(1000)
this.captchaSolver = new SolveCaptcha(page);
await this.captchaSolver.start((solution) => {
@@ -701,7 +700,7 @@ class CommandorPage {
}
// save to mongoDb
let reserve = ReserveResultPojo.create_from_contact(this.contact, id, url, this.choosedStore, publishType);
reserve.source_from = this.device.model();
reserve.source_from = this.device.serial();
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
await this.page.close();
// await this.deleteFromBlackList()
+1 -1
View File
@@ -62,7 +62,7 @@ class SlidingCaptchaSolver {
let x1 = (targetPosition.x2 + targetPosition.x1) / 2.0;
let width = targetPosition.x2 - targetPosition.x1;
let randomTime = randomIntFromInterval(100, 500)
let cmd = `adb -s ${device.serial()} shell input swipe ${x0} ${y0} ${x1 + width * 0.5} ${y0} ${1000 + randomTime}`
let cmd = `adb -s ${device.serial()} shell input touchscreen swipe ${x0} ${y0} ${x1 + width * 0.5} ${y0} ${600 + randomTime}`
await delay(2000);
console.log("cmd is " + cmd);
console.log("will slide captcha");