This is my html
<input name="__RequestVerificationToken" type="hidden" value="A9y6Ndf7Q2XP2Yz6zhaVChoIvpQGUrZRTvu9D_HnHnUcFBVInerxCjU4vpOXQYVhFwnzl-zAzkvtto7BLAVVr">
I want to extract value in jmeter Regular Expression Extractor.
This is my regx window but when i post it i will not get expected token it is something like this __RequestVerificationToken=%24%7Bauth_token%7D
.
Try using $1$
as a Template, it should resolve your issue.
Looking into your request I can see that you're sending %24%7Bauth_token%7D
which being decoded looks like ${auth_token}
so you use case is not correct.
You need 2 requests:
auth_token
variable. auth_token
variable. See Using Regular Expressions in JMeter guide for more details.
By the way, you can use combination of Debug Sampler and View Results Tree listener to see if there are any matches. It should be more convenient wrt groups and variables.
In general, it isn't recommended to use Regular Expressions to parse HTML. I would suggest to use XPath Extractor instead. Relevant XPath expression will look like:
//input[@name='__RequestVerificationToken']/@value
Few things to notice:
Use Tidy
box in XPath Extractor We need to set the following Regular Expression Extractor values to extract the auth token values
Reference Name : Auth_Token
Regular Expression : <input\sname="__RequestVerificationToken"\stype="hidden"\svalue="(.+)">
Template : $1$
Match No : 1
Default values : NOT FOUND TOKENS
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.