I am executing the load test by going through a login using Jmeter and unfortunately, I received a response forbidden code 403. While sending the login details a security token(named in the field _csrf
) is also sent by the server that is a random token generated at the time of login due to that my test case not passed. Here below I am sending the response HTML data in which It has stored in the input value.
I am trying it to save into the variable using Regular Expression Extractor so that I can use that variable in the login request directly instead os hard coding invalid token(_csrf)
.
HTML DATA
<body>
<!-- Used for modals to show login screen once timed out -->
<script type="text/javascript">
if (window.self != window.top) {
window.parent.location.reload();
}
</script>
<div id="main">
<div id="innermain" class="standalone-page x-narrow">
<div class=" container-fluid formcontainer">
<h2>Login</h2>
<form id="command" action="/login" method="POST"><fieldset>
<div class="form-row">
<div class="form-group col label-input">
<input name="username" id="username"/>
<label for="username">Username</label>
</div>
</div>
<div class="form-row">
<div class="form-group col label-input">
<input type="password" name="currentPassword" id="password"/>
<label for="password">Password</label>
</div>
</div>
<div class="form-row actions">
<div class="col">
<input type="submit" value="Login" class="mat-btn mat-btn-floating"/>
</div>
</div>
</fieldset>
<div>
<input type="hidden" name="_csrf" value="94sfdefa-6e8p-4a-a2-73720ffab5" />
</div></form></div>
</div>
</div>
</body>
</html>
<input type="hidden" name="_csrf" value="94sfdefa-6e8p-4a-a2-73720ffab5" />
Look for the above line in the HTML Response Data.
My request data look like:
Can anyone please help me out of this it would be really appreciable ??