如何在Jmeter中提取用于身份验证的令牌值

时间:2015-08-22 12:10:54

标签: jmeter

我想从响应数据中提取令牌值。我使用正则表达式提取器来获取VIEWSTATE & EVENTVALIDATION值,但我还需要从下面提到的响应中获得'8579B772905C87F270BC7E7D648572A5AB55D1B7E7FB7EA2C33F8281125935EEE3D12D705E3ED1EBE59D4B66C90738FC11B087AD5D123DEAE5C29DD57218B107'值:

<input id="btnSubmit" type="submit" name="Login" value="Login" class="login_N" onclick="

var pattern_Null = '^ *$';
var reg_Null = new RegExp(pattern_Null);

if(reg_Null.test(document.getElementById('txtUserId').value)){
    alert('Enter the Login Name');
    document.getElementById('txtUserId').focus();
    return false;
}

if(reg_Null.test(document.getElementById('txtPwd').value)){
    alert('Enter the Password');
    document.getElementById('txtPwd').focus();
    return false;
}

var s = document.getElementById('txtPwd').value;

document.getElementById('password').value = Encrypt(s,'8579B772905C87F270BC7E7D648572A5AB55D1B7E7FB7EA2C33F8281125935EEE3D12D705E3ED1EBE59D4B66C90738FC11B087AD5D123DEAE5C29DD57218B107','10001');

1 个答案:

答案 0 :(得分:0)

这应该有效:

  

加密(s,'([[''] +?)')

在模板字段中使用$ 1 $