Added error checks

This commit is contained in:
adithyagenie 2023-08-20 23:22:37 +05:30
parent 4dafb9c1b7
commit db284bc685

View file

@ -7,7 +7,7 @@
// ==UserScript== // ==UserScript==
// @name Math Problem Solver // @name Math Problem Solver
// @namespace https://github.com/adithyagenie/skillrack-captcha-solver // @namespace https://github.com/adithyagenie/skillrack-captcha-solver
// @version 0.2 // @version 0.3
// @description Solves math captcha in SkillRack using Tesseract.js // @description Solves math captcha in SkillRack using Tesseract.js
// @author adithyagenie // @author adithyagenie
// @include https://*.skillrack.com/* // @include https://*.skillrack.com/*
@ -26,6 +26,14 @@
console.log("Captcha not found!"); console.log("Captcha not found!");
return; return;
} }
const errors = document.getElementsByClassName("ui-growl-item");
if (errors.length > 0) {
if (errors[0].textContent.includes("Incorrect Captcha")) {
console.log("Detected failed attempt at solving captcha");
alert("I wasn't able to solve the captcha :/");
return;
}
}
const time = new Date().getTime(); const time = new Date().getTime();
// Invert colours for better ocr // Invert colours for better ocr