crash correction
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
await iframeHandler.locator(selector).focus()
|
||||
await iframeHandler.locator(selector).fill("" + number_list[i - 1])
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user