jmeter testcases which can handle captcha?

Koran picture Koran · Aug 6, 2011 · Viewed 9.3k times · Source

We are trying to build a jmeter testcase which does the following:

  • login to a system
  • obtain some information and check whether correct.

Where we are facing issues is because there is a captcha while logging into the system. What we had planned to do was to download the captcha link and display, and wait for user to type in the value. Once done, everything goes as usual.

We couldnt find any plugin that can do the same? Other than writing our own plugin, is there any option here?

Answer

Koran picture Koran · Aug 7, 2011

I was able to solve it myself. The solution is as follows:

  • Create a Beanshell Sampler

In it, the following code displays the captcha and waits for user input

filenameOrURL = new URL("${captchaimage}");
image = Toolkit.getDefaultToolkit().getImage(filenameOrURL);
Icon icon = new javax.swing.ImageIcon(image);

JOptionPane pane = new JOptionPane("Enter Captcha", 0, 0, null);
String captcha = pane.showInputDialog(null, "Captcha", "Captcha", 0, icon, null, null);

Then we can use the captcha variable in any way we want. Thank you everyone who tried to help.