From b19be8327e383f32cc6296019b27f95b0bab112a Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Sat, 27 May 2023 23:19:36 +0200 Subject: [PATCH] try to support mi note 10 --- src/workers/CommandorPage.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 554db8e..7dea133 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -218,6 +218,7 @@ class CommandorPage { async clickOnlineAppointment() { try { logWithDevice("will click on rdv link", this.device); + await this.connectBrowserIfNecessary(); const [button] = await this.page.$x("//a[contains(., 'rendezvousparis')]"); console.log("button is " + button) if (button) { @@ -701,6 +702,20 @@ class CommandorPage { } } + async connectBrowserIfNecessary() { + if (!this.browser.isConnected()) { + try { + this.browser = await puppeteer.connect({ + browserWSEndpoint: "ws://127.0.0.1:" + this.port + "/devtools/browser", + headless: false, defaultViewport: null + }) + } catch (e) { + console.log(e) + this.isTerminated = true; + } + } + } + async checkResultWithOcr() { console.log("checkResultWithOcr() called.") await delay(2000); @@ -867,6 +882,8 @@ class CommandorPage { this.device.shell("input tap " + 385 + " " + 1930) } else if (model === "ASUS_X00QD") { this.device.shell("input tap " + 490 + " " + 1910) + } else if (model === "Mi Note 10") { + this.device.shell("input tap " + 550 + " " + 1920) } else this.device.shell("input tap " + 385 + " " + 2050) await delay(2000);