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

查看:229
本文介绍了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);

然后,我们可以根据需要使用captcha变量.谢谢所有尝试提供帮助的人.

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

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

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