可以处理验证码的 jmeter 测试用例? [英] jmeter testcases which can handle captcha?

查看:35
本文介绍了可以处理验证码的 jmeter 测试用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试构建一个 jmeter 测试用例,它执行以下操作:

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

  • 登录系统
  • 获取一些信息并检查是否正确.

我们面临的问题是因为登录系统时有验证码.我们计划做的是下载验证码链接并显示,并等待用户输入值.完成后,一切照常进行.

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?

推荐答案

我自己解决了.解决方法如下:

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

  • 创建一个 Beanshell 采样器

其中,以下代码显示验证码并等待用户输入

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.

这篇关于可以处理验证码的 jmeter 测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆