From db284bc6851100f964290b5aaec7b1a11b8c1f29 Mon Sep 17 00:00:00 2001 From: adithyagenie Date: Sun, 20 Aug 2023 23:22:37 +0530 Subject: [PATCH] Added error checks --- userscript.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/userscript.js b/userscript.js index 0e61109..d047ac3 100644 --- a/userscript.js +++ b/userscript.js @@ -7,7 +7,7 @@ // ==UserScript== // @name Math Problem Solver // @namespace https://github.com/adithyagenie/skillrack-captcha-solver -// @version 0.2 +// @version 0.3 // @description Solves math captcha in SkillRack using Tesseract.js // @author adithyagenie // @include https://*.skillrack.com/* @@ -26,6 +26,14 @@ console.log("Captcha not found!"); 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(); // Invert colours for better ocr