Extracting value from HTML Responce using Regular expression in JMETER?

后端 未结 8 798
长发绾君心
长发绾君心 2020-12-11 21:09

I am getting response from Jmeter like this:

相关标签:
8条回答
  • 2020-12-11 21:47

    Better than using regular expression to extract that value I would suggest using XPath Extraction like this:

    //form[@name='MyForm']//input[@name='queueItemId']/@value
    

    Where MyForm is your form name, replace with whatever you have.

    0 讨论(0)
  • 2020-12-11 21:50

    Try something like:

    encounterId=([0-9]+)
    

    and use group 1 as the result.

    0 讨论(0)
  • 2020-12-11 21:52

    or try this code regexId = '\d+';

    0 讨论(0)
  • 2020-12-11 22:03
    var str = "<a href='/openmrs/module/moca/encounterViewer.form?encounterId=3537'></a>"
    var regex = /<a.*?href='(.*?)'/;
    var src = regex.exec(str)[1];
    var numb = src.split("=")[1];
    alert (numb);
    
    0 讨论(0)
  • 2020-12-11 22:05

    Here is the XPath query:-

    //input[@type="hidden"][@id="queueItemId"][@name="queueItemId"]@value

    0 讨论(0)
  • 2020-12-11 22:05

    The most maintainable way in recent version of JMeter is to use CSS/JQuery Extractor:

    The most performing one is to use new Boundary Extractor:

    If you really want to use Regular_Expression_Extractor :

    0 讨论(0)
提交回复
热议问题