Re: [jmeter-plugins]to get location from response header in jmeter

352 views
Skip to first unread message

Byzoor.,IAS

unread,
Apr 20, 2018, 10:20:04 AM4/20/18
to jmeter-...@googlegroups.com
Hi,
From response header to get the location details, 

Get the value 1234567
Is there any beanshell script to get the value and save in to Excel or text file.

gli...@gmail.com

unread,
Apr 23, 2018, 7:28:18 AM4/23/18
to jmeter-plugins
I've heard Groovy is the New Black and it is recommended to use it for scripting since JMeter 3.1 so you can achieve this using JSR223 PostProcessor and the following Groovy code:

def matcher = prev.getResponseHeaders() =~ 'http://abc.com/trip/us/(\\d+)'
if (matcher.find()) {
new File('id.txt') << matcher.group(1)
}

It will extract the value from the response headers and write it into id.txt file in JMeter's working directory (normally "bin" folder). See Using Regular Expressions in Groovy article for more details if needed. 
Reply all
Reply to author
Forward
0 new messages