简体   繁体   English

Jmeter 正则表达式提取器提取输入值

[英]Jmeter Regular Expression Extractor to extract an input value

I am new to Jmeter's Regular Expression Extractor.我是 Jmeter 正则表达式提取器的新手。 For an HTTP Request, I am getting an HTML Response.对于 HTTP 请求,我收到 HTML 响应。 I want to extract an e-mail address which is a hidden value in that response for use in the subsequent request.我想提取一个电子邮件地址,该地址是该响应中的隐藏值,以用于后续请求。

The string is:字符串是:

<input type="hidden" name="login" id="login" value="abs12.test@test.com" >

How can I do this?我怎样才能做到这一点?

You may also maybe like more effective XPath Extractor , used the same way as RegEx Extractor.您可能还喜欢更有效的XPath Extractor ,使用方式与 RegEx Extractor 相同。 XPath query will look like: XPath 查询将如下所示:

//input[@type='hidden'][@name='login']/@value

and extractor itself:和提取器本身:

xpath 提取器

Regexp as following正则表达式如下

id="login" value="(.*)"

This site has great tutorials on how to perl regex's: http://www.regular-expressions.info/这个网站有关于如何 perl 正则表达式的很棒的教程: http://www.regular-expressions.info/

I would also recommend getting the tool "Regex Coach" to help you write - it searches for your string in real time.我还建议使用“Regex Coach”工具来帮助您编写 - 它实时搜索您的字符串。

But, your regex will look something like:但是,您的正则表达式将类似于:

<input type="hidden" name="login" id="login" value="(.+?)" > 

You want to make sure you include the (), as that is the part JMeter will store into your variable.您要确保包含 (),因为这是 JMeter 将存储到您的变量中的部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM