'Want to extract data in JMeter

I am using the HTTP request sampler, In which I have used Post Method. When I Execute the request, it executes the another HTTP request from another thread.

I want to extract the data from that thread because that HTTP request contains the transaction id and I want to use that transaction id in other threads.

The said transaction id is only showing in the pop up message.

Kindly help me.



Solution 1:[1]

Solution for the first problem retrieving data from request URL i.e.transaction id using a postprocesser, you can refer the following thread,

Post processer for extracting a value from the URL in the request method.

Solution for the second problem passing the variable from one thread to another,

  1. You need to add a beanshell assertion and set it a property variable like ${__setProperty(transaction_id, ${transID})}

  2. In the second thread group add a preprocesser and accept the property variable.

    String tid= props.get("transaction_id");

    vars.put("TID",tid);

Thread1:

enter image description here

Thread2:

enter image description here

Solution 2:[2]

JMeter can only extract data from response body, message, code, headers, or URL.

If you send the request which triggers another request and the data you're looking for is not in the 1st request response scope - unfortunately you won't be able to get it.

The only option I can think of is using WebDriver Sampler which provider JMeter integration with Selenium browser automation framework so you would be able to execute the request and get the data from the popup using real browser.

WebDriver Sampler can be installed using JMeter Plugins Manager

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jyoti Prakash Mallick
Solution 2 Dmitri T