0

How to write json path expressions for the below script in jmeter . I need to get the two dynamic values session id and csrf

<input type="hidden" name="_txtSession_Id" value="tw-2777518705045647360wor" >         
<input type="hidden" name="csrf_token" value="QIuBhc0mxMfA0XMczGIoZ+jPRprc3wfxbxCfjHiAykU=" />
Bsquare ℬℬ
  • 4,423
  • 11
  • 24
  • 44
Riya
  • 529
  • 4
  • 10
  • 18
  • I [edited your question](https://stackoverflow.com/help/editing), improving either its formatting, or [its quality](https://stackoverflow.blog/2011/02/05/suggested-edits-and-edit-review/) to help people understanding your question, and to help you to get an appropriate answer. But you still may need to add further information for your question to become fully solvable. – Bsquare ℬℬ Dec 14 '18 at 09:07

1 Answers1

0

You cannot use JSON Extractor on HTML data, consider using CSS Selector Extractor instead.

The relevant configuration would be something like:

  • Name of created variable: anything meaningful, i.e. _txtSession_Id
  • CSS Selector Expression: input[name=_txtSession_Id]
  • Attribute: value

That's it, you will be able to refer the first value as ${_txtSession_Id} where required.

The same way you can extract csrf_token, just change CSS Selector Expression to input[name=csrf_token]

You can test your CSS Expressions using View Results Tree listener

enter image description here

Dmitri T
  • 159,985
  • 5
  • 83
  • 133