Justin Gardner
Justin Gardner

Reputation: 625

Javascript Generated Captcha

If you guys go to this page, you will see a captcha. However, whenever I use Python's mechanize module to load up this page, I don't get the tag in the HTML. This makes me think it is generated using Javascript. However, If I go to the page in my browser, I can "inspect element" and find the image tag. Do you guys know any way I can automate the task of fetching that captcha? I'm kind of at a loss here....

Thanks so much,

Justin

Upvotes: 1

Views: 418

Answers (1)

jfriend00
jfriend00

Reputation: 707328

The captcha DOM elements are inserted via javascript and the captcha image itself is created server-side and then displayed in the page.

The only two ways to create the same captcha information yourself are:

  1. Let the javascript in the page run and then somehow fetch the DOM elements that the javascript creates.

  2. Reverse engineer their captcha insertion code and try to figure out what it's doing so you can run your own code to create something similar.

There are also at least a couple ajax calls involved in their captcha processing too. Perhaps if you could explain what you're really trying to accomplish, we could offer some better ideas. Hopefully, you aren't trying to automate the filling out of a captcha since its purpose is to prevent that.

Upvotes: 2

Related Questions