Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jmeter testcases which can handle captcha?

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?

like image 748
Koran Avatar asked Aug 06 '11 02:08

Koran


People also ask

Can we handle Captcha in JMeter?

CAPTCHA is an acronym which means Completely Automated Public Turing Test To Tell Computers and Humans Apart so it means you won't be able to handle it using JMeter.

How does loadrunner handle Captcha?

Disable the security feature: You can ask the developer to disable the security feature like Captcha or OTP of the application for testing purpose only. In that case, you do not need to include the request/function which handles captcha or OTP. But such an approach bypasses the security code (logic) of the application.

What does CAPTCHA stand for?

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a type of security measure known as challenge-response authentication.

What is JMeter used for?

What is JMeter? Apache JMeter is an open source Java application designed to load test functional behavior and gauge software performance. Originally designed for testing web apps, it has since expanded to include other test-related functions.


3 Answers

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.

like image 181
Koran Avatar answered Oct 24 '22 02:10

Koran


Since CAPTHA used to detect non-humans, JMeter will always fail it.

You have to make a workaround in your software: either disable captcha requesting or print somewhere on page correct captcha. Of course, only for JMeter tests.

like image 44
Andrey Pokhilko Avatar answered Oct 24 '22 00:10

Andrey Pokhilko


Dirty workaround? Print the captcha value in alt image for the tests. And then you can retrieve the value and go on.

like image 3
Syl Avatar answered Oct 24 '22 02:10

Syl