Anticaptcha JS not working

Hi,

Firstly, great tool btw!

This one is related to Anticaptcha. I have the following steps on my macro (got the step from this link):
{
“Command”: “executeScript”,
“Target”: “(function(){var d=document.getElementById("anticaptcha-imacros-account-key");d||(d=document.createElement("div"),d.innerHTML="myAntiCaptchaApiKeyGoesHere",d.style.display="none",d.id="anticaptcha-imacros-account-key",document.body.appendChild(d))})();”,
“Value”: “”
},
{
“Command”: “executeScript”,
“Target”: "(function(){var s=document.createElement("script");s.src="https://cdn.antcpt.com/imacros_inclusion/recaptcha.js?\“+Math.random();document.body.appendChild(s);})();”,
“Value”: “”
}

The above works when:

  1. I’m solving a captcha and these steps are on the earlier steps of the macro (e.g. before line 10) or
  2. When I’m executing the steps “adhoc-ly” (e.g. Execute command or Run from here).

IT DOESN’T WORK when these steps are on the last parts of my macro (e.g. executed on line 66). Any thoughts on this?

I have tried to eliminate the variables such as:

  1. I tried putting the above steps on a sub macro and calling it on my main macro – still doesn’t work
  2. I tried putting it on the same script as my main macro – still doesn’t work

Note: Only UI.Vision and Chropath extensions are active on my Chrome browser

Hope you can shed some light on this. Thank you!

The anti-captcha pays says that you need to “add these two instructions after a page loading and before filling form” - did you do this?

solving a captcha and these steps are on the earlier steps of the macro (e.g. before line 10)

For my understanding… if it works there, why not keep it before line 10?

Thank you for answering!

We’ll, the captcha is needed on the latter parts of the code. I tried putting it on a submacro (so that it mets the “requirement” before line # 10) but still it doesn’t work. It only runs when executed adhocly. I know it’s silly but I really don’t know what happening there.

I have this exact same problem. Is anyone able to help? @Plankton @jpnd @AntiCaptchaPlugin The reason why I want it later in the code is that filling out the form takes some time. By the time the form has been filled out, the captcha expires. So I would like to be able to run the captcha only when I am ready and then wait for it to be solved.

I am using the code from that same link too:

 {
      "Command": "storeEval",
      "Target": "(function(){var d=document.getElementById(\"anticaptcha-imacros-account-key\");d||(d=document.createElement(\"div\"),d.innerHTML=\"YOUR-ANTI-CAPTCHA-API-KEY\",d.style.display=\"none\",d.id=\"anticaptcha-imacros-account-key\",document.body.appendChild(d))})();",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "(function(){var s=document.createElement(\"script\");s.src=\"https://cdn.antcpt.com/imacros_inclusion/recaptcha.js?\"+Math.random();document.body.appendChild(s);})();",
      "Value": ""
    }

Any suggestions? It works when I put it at the top of my macro, but not toward the bottom of my macro after I have filled out the form. HOWEVER, it does work if I manually initiate it, if I click on
run from here" on the macro manually, then it DOES work.

Why would it not work when part of the macro but work when manually running it?

anyone have any suggestions?

I am not sure if that is reason, but I learned that storeEval is deprecated. Did you try using ExecuteScript instead?

 {
      "Command": "ExecuteScript",
      "Target": "(function(){var d=document.getElementById(\"anticaptcha-imacros-account-key\");d||(d=document.createElement(\"div\"),d.innerHTML=\"YOUR-ANTI-CAPTCHA-API-KEY\",d.style.display=\"none\",d.id=\"anticaptcha-imacros-account-key\",document.body.appendChild(d))})(); return 1;",
      "Value": "var1notused"
    },
    {
      "Command": "ExecuteScript",
      "Target": "(function(){var s=document.createElement(\"script\");s.src=\"https://cdn.antcpt.com/imacros_inclusion/recaptcha.js?\"+Math.random();document.body.appendChild(s);})(); return 1",
      "Value": "var1notused"
    }

I have no anticaptcha-imacros-account-key so I can not test.

thanks so much! I am updating my code to ExecuteScript going forward instead of the deprecated storeEval. However unfortunately switching to ExecuteScript still doesn’t solve that issue - on a large page the captcha is only able to be solved when the page is first loaded as opposed to after text has been input, different menu items selected etc

Any other suggestions I could try?

@sharkman Did you try to contact the Anticaptcha support directly?

With iMacros getting killed by the current owner, I agree that UIV is the best imacros alternative. So the anticaptcha guys should update their UI.Vision sample page ASAP :wink:

Thanks. I have written to them almost a month ago and followed up 2x times but no reply! Maybe they are not interested or don’t know! @AntiCaptchaPlugin @admin