1

Please let me know how to fetch the ID from the html using a regular expression & find the below expression i have used but am getting error response only.

Response Body:

"input type="hidden" name="paymentId" value='234201921134768136' "

Regular Expression:

input type="hidden" name="paymentId" value="(.+?)" 

Variable name : paymentId

2 Answers 2

1

If you really want to use regular expressions for this, here you go:

input type="hidden" name="paymentId" value="(\d+)"

Demo (assumes RegExp Tester more of the View Results Tree listener):

enter image description here

However be informed that using regular expressions for parsing HTML is not the best idea as regular expressions are very sensitive to markup changes and extra space or line break will ruin your regex.

Consider going for CSS Selector Extractor instead, it allows using CSS Selectors for querying the document which is way more readable, robust and reliable

enter image description here

0

I would suggest using the CSS JQuery Extractor:

enter image description here

On CSS/JQuery Expression you locate HTML node and on Attribute you will extract the value of a given attribute (name in your case).

3
  • Thanks...Actually the payment id dynamically change for every user...so CSS/JQuery Expression would be applicable for this? can you confirm this???
    – syed
    Commented Jul 30, 2019 at 9:13
  • It is a post-processor, meaning that the flow of execution will be directed to the following ThreadGroup (TG). If you want, e.g., make a GET to the payments service, you will have the value of payment id to be used. On the following user, the two (TG) will be run in this order as well. User 1: TG1 -> Post-Processor -> TG2 User 2: TG1 -> Post-Processor -> TG2 Never intertwined. You can have more info here: guru99.com/processor-in-jmeter.html Commented Jul 30, 2019 at 13:32
  • I am accessing external sites using company proxy server due to this i am unable to record those sites using jmeter. Can you help me on this issue.
    – syed
    Commented Aug 2, 2019 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.