add await

This commit is contained in:
PAN Lei
2023-01-12 15:55:01 +01:00
parent aa8cb2da99
commit 0f4a990d1a
4 changed files with 24 additions and 16 deletions
+7 -5
View File
@@ -1,3 +1,5 @@
import {devices} from "playwright";
const {SolveCaptcha, TWO_CAPTCHA_CONNECTION_FAILED} = require("./SolveCaptcha");
const ReserveResultPojo = require("../models/ReserveResultPojo");
const BlackListContactPojo = require("../models/BlackListContactPojo");
@@ -9,7 +11,7 @@ const {
const GeoCaptchaSolver = require("./GeoCaptchaSolver");
// const RDV_URL = "http://192.168.0.41:8000/test_appointment.html"
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
BLANK_URL = "about:blank"
const BLANK_URL = "about:blank"
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
const COUNTRY_ID = "#phone_country"
@@ -34,9 +36,9 @@ const TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests"
const TOO_MANY_REQUEST_ERROR_MESSAGE_FR = "Suite à un trop grand nombre de demandes"
const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
const DEFAULT_STORE = 'faubourg';
const searchTexts = ['hermes+rdv', 'hermes+rendezvous', 'hermes+appointment','hermes+appointment+online', 'appointment+hermes','hermes+rendez+vous', 'online+appointment+hermes', 'hermes+online+appointment']
const searchTexts = ['hermes+rdv', 'hermes+rendezvous', 'hermes+appointment', 'hermes+appointment+online', 'appointment+hermes', 'hermes+rendez+vous', 'online+appointment+hermes', 'hermes+online+appointment']
function delay(delayInMs) {
return new Promise(resolve => {
@@ -121,8 +123,8 @@ class CommandorPage {
let cancel
const intervalTask = setInterval(() => {
if (this.isTerminated) {
log("request terminated, will close device")
context.close()
log(this.device.model() + ":request terminated, will close device");
context.close();
// this.page.close()
this.device.close()
clearInterval(intervalTask)