try to fix sliding probleme

This commit is contained in:
2024-09-24 16:01:41 +02:00
parent 1c35cd1831
commit 4ee264c650
2 changed files with 21 additions and 22 deletions
+20 -21
View File
@@ -734,7 +734,7 @@ class CommandorPage {
await delay(5000); await delay(5000);
} }
await this.slidingCaptchaSolver.solve(this.page, async (isSuccessful) => { await this.slidingCaptchaSolver.solve(this.page, async (isSuccessful) => {
logWithDevice("check isAlwaysBlocked",this.device) logWithDevice("check isAlwaysBlocked", this.device)
this.isFillingFields = false this.isFillingFields = false
onResult(isSuccessful) onResult(isSuccessful)
}) })
@@ -869,26 +869,6 @@ class CommandorPage {
logWithDevice("will recheck OCR", this.device) logWithDevice("will recheck OCR", this.device)
checkResult = await this.ocrChecker.get_result(); checkResult = await this.ocrChecker.get_result();
} }
while (checkResult === OCRResult.SLIDING_CAPTCHA) {
logWithDevice("will call this.slidingCaptcha()", this.device)
await this.slidingCaptcha(async (isSuccessful) => {
logWithDevice("SLIDING_CAPTCHA result is " + isSuccessful, this.device)
console.log(checkResult);
if (isSuccessful) {
await delay(5 * 1000)
checkResult = await this.ocrChecker.get_result();
// await this.checkResultWithOcr()
} else {
await this.checkResultWithOcr()
// if (checkResult === OCRResult.SLIDING_CAPTCHA) {
// checkResult = OCRResult.TERMINAED
// this.isTerminated = true
// }
}
})
await delay(10 * 1000)
}
switch (checkResult) { switch (checkResult) {
case OCRResult.SLIDING_CAPTCHA_LOADING: case OCRResult.SLIDING_CAPTCHA_LOADING:
this.isTerminated = true; this.isTerminated = true;
@@ -902,6 +882,25 @@ class CommandorPage {
case OCRResult.SLIDING_CAPTCHA_REFRESH: case OCRResult.SLIDING_CAPTCHA_REFRESH:
await this.connect_to_browser(checkResult) await this.connect_to_browser(checkResult)
break; break;
case OCRResult.SLIDING_CAPTCHA:
logWithDevice("will call this.slidingCaptcha()", this.device)
await this.slidingCaptcha(async (isSuccessful) => {
logWithDevice("SLIDING_CAPTCHA result is " + isSuccessful, this.device)
console.log(checkResult);
if (isSuccessful) {
await delay(5 * 1000)
// checkResult = await this.ocrChecker.get_result();
await this.checkResultWithOcr()
} else {
await this.checkResultWithOcr()
// if (checkResult === OCRResult.SLIDING_CAPTCHA) {
// checkResult = OCRResult.TERMINAED
// this.isTerminated = true
// }
}
})
// await delay(5 * 1000)
break;
case OCRResult.FILL_FIELD: case OCRResult.FILL_FIELD:
logWithDevice("FILL_FIELD", this.device) logWithDevice("FILL_FIELD", this.device)
if (this.browser === undefined || !this.browser.isConnected()) { if (this.browser === undefined || !this.browser.isConnected()) {
+1 -1
View File
@@ -213,7 +213,7 @@ class OCRChecker {
async take_screen_shot() { async take_screen_shot() {
let name = this.get_file_name() let name = this.get_file_name()
console.log("will take screenshot for " + this.device.model + ":" + this.device.serial) console.log("will take screenshot for " + this.device.model + ":" + this.device.serial)
console.log("name is " + name) console.log("OCRChecker.name is " + name)
let stdout1 = await exec("adb -s " + this.device.serial + " exec-out screencap -p > " + name) let stdout1 = await exec("adb -s " + this.device.serial + " exec-out screencap -p > " + name)
await delay(5000); await delay(5000);
console.log(`stdout: ${stdout1}`); console.log(`stdout: ${stdout1}`);