crash correction

This commit is contained in:
2022-12-08 16:47:52 +01:00
parent 32347a3865
commit 82b297fdd3
3 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -336,7 +336,7 @@ class CommandorPage {
if (audioBtn) {
log("audioBtn found")
audioBtn.click()
let captchaSolver = new GeoCaptchaSolver(this.page, this.device)
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
await captchaSolver.solve((isSuccessful) => {
if (!isSuccessful) {
this.isTerminated = true
+7 -1
View File
@@ -51,8 +51,9 @@ async function sendRequest(fileName, callback) {
}
class GeoCaptchaSolver {
constructor(page, device) {
constructor(page, device, isTerminated) {
this.page = page;
this.isTerminated = isTerminated
this.device = device;
}
@@ -69,11 +70,16 @@ class GeoCaptchaSolver {
if (!html.includes("You have been blocked")) {
// find wav from html
await this.findTextFromWavFile(html, async (number_list) => {
console.log("number_list size is " + number_list.length)
for (let i = 1; i <= number_list.length; i++) {
let selector = "#captcha__audio > div.audio-captcha-input-container > input:nth-child(" + i + ")"
// console.log("selector is " + selector)
try {
await iframeHandler.locator(selector).focus()
await iframeHandler.locator(selector).fill("" + number_list[i - 1])
} catch (e) {
console.log(e)
}
// fieldInputs[i].value = number_list[i];
await delay(800 + getRandomWaitTime());
}
+1 -1
View File
@@ -134,7 +134,7 @@ class LinkValidator {
if (!this.isTerminated) {
try {
audioBtn.click()
let captchaSolver = new GeoCaptchaSolver(this.page, this.device)
let captchaSolver = new GeoCaptchaSolver(this.page, this.device, this.isTerminated)
await captchaSolver.solve((isSuccessful) => {
if (!isSuccessful) {
this.isTerminated = true