here is the screenshot of jsr223 postprocessorCreate two variables assign month as one variable and year as another variable and pass into next request using JSR223 post processor am getting issue while doing this,can anyone please suggest me

marked as duplicate by Kate Paulk Oct 17 '18 at 11:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


If your parent sampler response is <a href=?/statement.php?month=07&amp;year=2018?> and you want to extract the month and the year using JSR223 PostProcessor you can use the code like:

def response = prev.getResponseDataAsString()

log.info('Response: ' + response)

def matcher = response =~ "month=(\\d+).*year=(\\d+)"
if (matcher.find()) {
    vars.put('month', matcher.group(1))
    vars.put('year', matcher.group(2))

log.info('Detected month as ' + vars.get('month') + ' and year as ' + vars.get('year'))

Assuming everything goes well you should be able to refer month as ${month} and year as ${year} where required.


JMeter Demo

More information:

  • tq so much for ur valuable answer @Dmitri T – Guruganesh Jul 26 '18 at 4:40

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