do not duplicate contacts

This commit is contained in:
Lei PAN
2023-04-11 16:23:44 +02:00
parent 46af10ceac
commit db21a69926
3 changed files with 56 additions and 41 deletions
+15 -10
View File
@@ -182,7 +182,7 @@ class CommandorPage {
if (!page.isClosed()) {
if (!this.isPhoneInput) {
await page.locator(PHONE_NUMBER).focus();
await page.locator(PHONE_NUMBER).fill("0" + this.contact.phoneNumber);
await page.locator(PHONE_NUMBER).fill("+330" + this.contact.phoneNumber);
this.isPhoneInput = true;
}
}
@@ -391,17 +391,10 @@ class CommandorPage {
//try to sliding capthca at first
let slidingCaptchaSolver = new SlidingCaptchaSolver(this.device);
await slidingCaptchaSolver.solve(this.page, async (isSuccessful) => {
console.log("check isAlwaysBlocked")
let isAlwaysBlocked = await this.isBlocked();
if (isAlwaysBlocked) {
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
log("audioBtn found")
audioBtn.click()
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
await captchaSolver.solve((isSuccessful) => {
if (!isSuccessful) {
this.isTerminated = true
}
})
await this.resolveByAudio();
}
})
} else {
@@ -412,6 +405,18 @@ class CommandorPage {
}
}
async resolveByAudio() {
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
log("audioBtn found")
audioBtn.click()
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
await captchaSolver.solve((isSuccessful) => {
if (!isSuccessful) {
this.isTerminated = true
}
})
}
async onResponse(response) {
// let rex = new RegExp(REGEX_RDV_URL)
// log("onResponse with url:" + response.url())