How to automate random captcha using Selenium IDE?

| | 1 min read

Suppose if a Drupal login page has a Captcha to find whether the user is human or a bot. Using Selenium IDE we can automate all type of web elements such as link, check box, radio button etc. In case of Captcha, human interaction is a must.

There are two ways to automate random captcha

  • Using Breakpoint
  • Using input box

In Selenium IDE, we can set breakpoint by using 'break' command at required place. Another method is to right-click on the required command and select 'Toggle Breakpoint' from the context menu. So the execution will pause at this particular command, now enter the captcha manually and continue execution of remaining commands.

Consider example

command A // Command to type Username

Command B // Command to type Password

break

Command C // Command to click Login Button

In the second case , we can automate Captcha with the help of Input box. The input box consist of Text field with Cancel and Ok button. We can enter the Captcha on the textfield and click Ok button, it will automatically enter corresponding captcha field of the login page.

inputbox.jpg

Script used for creating Input box and Accepting Captcha

storeEval prompt("Please enter captcha"); captcha
type id=captcha ${captcha}

Input.jpg

storeEval command is for storing value accepted through input box. Id specifies id value corresponding text field of the captcha in the login page.

Hope this article would help you to automate random captcha using Selenium IDE.