Home > Blockchain >  How to extract token value from response body in a HTML doctype format - JMETER
How to extract token value from response body in a HTML doctype format - JMETER

Time:04-02

I want to extract a dynamic token named and use it in another call. From the GET call, I get this token in a form of response body HTML which contains my desired token(dynamic value)

Response body is

<div >
    <label  for="registration-form-phone">
        Phone Number
        <span  data-toggle="tooltip" data-placement="top" title="Enter only numeric digits 0-9. We only call if there is an issue with your order.">&#9432;</span>
    </label>
    <input
        type="tel"
        
        id="registration-form-phone"
        maxlength="10"
        pattern="^[0-9] $"
        data-missing-error="This field is required."
        data-pattern-mismatch="Please enter a valid phone number"
        data-range-error="Must be 9 characters or less."
        aria-describedby="registration-form-phone-error"
        name="dwfrm_profile_customer_phone" required aria-required="true" value="" maxLength="10" pattern="^[0-9] $" />
    <div  id="registration-form-phone-error"></div>
</div>

<input type="hidden" **name="cgrf_token" value="jZWOYBqFDvEjoCxSP0aQ9mdufZqwwODp8D74MKo_6uDyL-Zic_ORmQ16f8boHv2-U=**"/>

<button type="submit" name="save" >
        Create Account
</button>

Requirement: Need to extract value under the value attribute right after name="cgrf_token" attribute here. What would be the regex for this?

Thanks

CodePudding user response:

For this use JMeter Post Processor XPath2_Extractor enter image description here

More information:

  • Related