From a801038c55589fdf5848d503522db51745e86afb Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Tue, 18 Jul 2023 14:43:41 +0200 Subject: [PATCH] use brave as browser --- src/workers/CommandorPage.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index d196afd..301e32b 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -8,7 +8,8 @@ const puppeteer = require('puppeteer'); const GeoCaptchaSolver = require("./GeoCaptchaSolver"); const SlidingCaptchaSolver = require("./SlidingCaptchaSolver"); const OCRChecker = require("./OCRChecker"); -const {main} = require("yarn/lib/cli"); +const {main, elephant} = require("yarn/lib/cli"); +const {exec} = require("child_process"); // 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" @@ -665,6 +666,11 @@ class CommandorPage { async slidingCaptcha(onResult) { logWithDevice("slidingCaptcha", this.device); + if (this.device.model() === "MI 5s") { + let cmd = `adb -s ${this.device.serial()} shell input touchscreen swipe 900 495 900 295` + await exec(cmd); + await delay(1000); + } let slidingCaptchaSolver = new SlidingCaptchaSolver(this.device); await slidingCaptchaSolver.solve(this.page, async (isSuccessful) => { console.log("check isAlwaysBlocked") @@ -893,12 +899,18 @@ class CommandorPage { await this.checkResultWithOcr(); break; case OCRResult.BRAVE_PRIVACY: - await this.device.shell("input tap " + 500 + " " + 1120) + if (this.device.model() === "MI 5s") + await this.device.shell("input tap " + 530 + " " + 970) + else + await this.device.shell("input tap " + 500 + " " + 1120) await delay(2000); await this.checkResultWithOcr(); break; case OCRResult.BRAVE_PRIVACY_PUB: - await this.device.shell("input tap " + 455 + " " + 1920) + if (this.device.model() === "MI 5s") + await this.device.shell("input tap " + 60 + " " + 900) + else + await this.device.shell("input tap " + 455 + " " + 1920) await delay(2000); await this.checkResultWithOcr(); break; @@ -993,8 +1005,11 @@ class CommandorPage { async handleBraveSkipBtn() { - if (this.device.model() === "CPH2219") { + let model = this.device.model() + if (model === "CPH2219") { await this.device.shell("input tap " + 558 + " " + 1160) + } else if (model === "MI 5s") { + await this.device.shell("input tap " + 530 + " " + 1000) } else { await this.device.shell("input tap " + 470 + " " + 1160) }