But somethimes there is simply no other way. It's not convenient, ugly and not recommended to do. Instead of creating a SCRIPT element you just put into your script a content of the following fileĪll the code that solves a captcha and modules are compiled into a big big single line. In such cases a whole code of a JS recaptcha solving file can be placed by one line. On certain websites it's forbidden to include any external JS file because of a Content-Security-Policy header and our recaptcha.js won't be embedded as well. It's always recommended to connect this JS file from our web-server to have a latest version of this script with all the fixes and new features.Īs a result, we have the following script: This piece of code creates a SCRIPT element with a src= and appends it into DOM. Var s = document.createElement("script") Now it time to connect a script itself which does all the job: For instance in a browser console (F12) or in another includible JS file or using any other extension e.g. This piece of code can be run in any environment. This API key will be used by the main JS code. We just created an invisible element with id=anticaptcha-imacros-account-key and placed an API key inside of it and then put this element into the target web-page. You only need to replace YOUR-ANTI-CAPTCHA-API-KEY with your key. Var d = document.getElementById("anticaptcha-imacros-account-key") ĭ.innerHTML = "YOUR-ANTI-CAPTCHA-API-KEY" ĭ.id = "anticaptcha-imacros-account-key" This includible JS file also good for iMacros application, the only difference is that it should be connected otherwise, you can see an example on the reCAPTCHA 2 solving in iMacros application web-page.īefore we use a main code that solves a Recaptcha we need to set our AntiCaptcha API key which is placed into a DIV element using the following code: It works only for a Recaptcha at the moment, image captchas are not supported.
For those who use headless browsers or just can't/doesn't want to install our extension we've developed an includible JS file which solves a captcha.