0

I am doing a web scraping project in which i stumbled upon a web page that has captcha. Now the thing is that the link that captcha is only shown when i hit refresh captcha button, which is in fact a java-script function called refresh capthca. Here is the code of button :

     <a title="Request a new validation code." href="javascript: refreshCaptcha();"      onclick="#">
     <img src="index.jpg" border="0" style="vertical-align:bottom;" width="23" height="22"></a>

How to call that function or click on that refresh captcha button using python script?

3
  • where is the code of button ? Commented Aug 2, 2015 at 13:38
  • are you using scrapy? if not I recommend using it Commented Aug 2, 2015 at 13:40
  • I am using Beautiful Soup for scraping purpose. Commented Aug 2, 2015 at 13:42

1 Answer 1

1

If you have node installed you can use the subprocess module

from subprocess import call
call(['node', '-e', 'JavaScript', 'code', 'here'])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.