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