Skip to content
Advertisement

Submitting reCAPTCHA v2 with selenium and python – no form submit button

So I recently signed up with anti-captcha and have been testing with the https://github.com/ad-m/python-anticaptcha/blob/master/examples/recaptcha_selenium.py script.

I cannot get past a reCAPTCHA that has no submit button (hidden or visible) nor a clear way to submit for verification. I’ve used the anti-captcha firefox plugin, so I know it can be passed. But I am stuck at the point of doing this manually myself.

I thought this was going to be a helpful answer, but it doesn’t go into depth. I am able to get the job.get_solution_response() token and enter it into the required textfield, but I cannot submit the “form.”

Does anyone have success with this? I am also looking to do this in a headless version of the browser. Would a solution be different based on headless vs non-headless?

BTW, realtor(dot)com is the website I am having trouble with. If I am not aloud to post this site, please let me know so I can remove it.

Advertisement

Answer

I went back into the source code of the site and found they are using a function as a callback for verification…

I saw that they are using a function called solvedCaptcha and injecting a variable name payload. So here is how I solved it:

NOTE: Make sure the driver is currently on the reCAPTCHA page.

driver.execute_async_script("var payload = '<enter the job.get_solution_response() here>'; solvedCaptcha(payload);")

This async script then calls the page’s verification and it reloads the blocked window.

NOTE: This CAPTCHA did not have a submit button and was not placed in a form. So using .submit() on an item within the driver would not work.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement