jmeter testcases which can handle captcha?

前端 未结 3 700
一生所求
一生所求 2020-12-29 00:26

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

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

相关标签:
3条回答
  • 2020-12-29 00:55

    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.

    0 讨论(0)
  • 2020-12-29 01:04

    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.

    0 讨论(0)
  • 2020-12-29 01:05

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

    0 讨论(0)
提交回复
热议问题