can input numbers

This commit is contained in:
2022-09-27 23:43:39 +02:00
parent ba6c856eb4
commit 4df9e003e0
+11 -10
View File
@@ -61,21 +61,22 @@ class GeoCaptchaSolver {
let captcha_container = await iframeHandler.locator(CAPTCHA_CONTAINER)
let html = await captcha_container.innerHTML()
console.log("audio_tag: " + html);
let fieldInputs = await iframeHandler.locator("#captcha__audio > div.audio-captcha-input-container > input:nth-child(1)")
// find wav from html
await this.findTextFromWavFile(html, (number_list) => {
for (i; i < number_list.length; i++) {
this.page.evaluate((info) => {
let input_fileds = document.getElementsByClassName("audio-captcha-inputs");
input_fileds[info.index].focus();
input_fileds[info.index].value = info.number;
}, {'index': i, 'number': number_list[i]})
delay(getRandomWaitTime());
await this.findTextFromWavFile(html, async (number_list) => {
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])
// fieldInputs[i].value = number_list[i];
await delay(getRandomWaitTime());
}
}
)
}
async findTextFromWavFile(html) {
async findTextFromWavFile(html, callback) {
let result = re.exec(html);
//create the directory if not exist
await fs.promises.mkdir(dest_dir, {recursive: true});
@@ -89,7 +90,7 @@ class GeoCaptchaSolver {
} else {
console.log('download the file successfully');
// send request to get numbers
sendRequest(fileName);
sendRequest(dest_dir + fileName, callback);
}
})
}