add onResult callback

This commit is contained in:
2022-09-28 18:50:34 +02:00
parent 4752289d50
commit 0719ffeac5
2 changed files with 11 additions and 2 deletions
+5 -1
View File
@@ -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")
}
+6 -1
View File
@@ -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)
}
}
)
}