add onResult callback
This commit is contained in:
@@ -329,7 +329,11 @@ class CommandorPage {
|
|||||||
log("audioBtn found")
|
log("audioBtn found")
|
||||||
audioBtn.click()
|
audioBtn.click()
|
||||||
let captchaSolver = new GeoCaptchaSolver(this.page)
|
let captchaSolver = new GeoCaptchaSolver(this.page)
|
||||||
await captchaSolver.solve()
|
await captchaSolver.solve((isSuccessful) => {
|
||||||
|
if (!isSuccessful) {
|
||||||
|
this.isTerminated = true
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
log("audioBtn not found")
|
log("audioBtn not found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class GeoCaptchaSolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async solve() {
|
async solve(onResult) {
|
||||||
console.log("solve() called.")
|
console.log("solve() called.")
|
||||||
console.log("play audio")
|
console.log("play audio")
|
||||||
let iframeHandler = await this.page.frameLocator("body > iframe");
|
let iframeHandler = await this.page.frameLocator("body > iframe");
|
||||||
@@ -76,6 +76,11 @@ class GeoCaptchaSolver {
|
|||||||
// fieldInputs[i].value = number_list[i];
|
// fieldInputs[i].value = number_list[i];
|
||||||
await delay(2000 + getRandomWaitTime());
|
await delay(2000 + getRandomWaitTime());
|
||||||
}
|
}
|
||||||
|
if (number_list.isEmpty()) {
|
||||||
|
onResult(false)
|
||||||
|
} else {
|
||||||
|
onResult(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user