Hi,
This is my html page source :-
<div class="form-top">
<div class="form-top-left">
<h3>hoardalot.com</h3>
<p>Enter Email and Password:</p>
</div>
<div class="form-top-right">
<i class="fa fa-fw fa-lock"></i>
</div>
</div>
<div class="form-bottom">
<form role="form" method="post" class="login-form" action="/ui/login">
<div class="form-group">
<label class="sr-only" for="form-username">Email</label>
<input type="email" autocomplete="off" name="username" placeholder="Email..." class="form-username form-control" id="form-username" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" title="name@domain e.g: scott@gmail.com " required="true" />
</div>
<div class="form-group">
<label class="sr-only" for="form-password">Password</label>
<input type="password" name="password" placeholder="Password..." class="form-password form-control" id="form-password" />
</div>
<button type="submit" class="btn">Log In !</button>
<input type="hidden" name="_csrf" value="8a600709-08aa-41ee-9bd8-b8079e99a820" /></form>
</div>
<div>
<div style="float:left" class="col-md-6 col-sm-6"><a href="register"><i class="fa fa-fw fa-user-plus"> </i>Register</a></div><div style="float:left" class="col-md-6 col-sm-6"><a href="forgotPassword"><i class="fa fa fa-recycle"> </i>Forgot Password?</a></div>
</div>
The hidden element name = _csrf.
It gets recorded as follows :-
.exec(http(“request_39”)
.post("/ui/login")
.headers(headers_0)
.formParam(“username”, “tina@hoardalot.com”)
.formParam(“password”, “tina”)
.formParam("_csrf", “fb0324b0-9629-47e7-8c12-578a28b7b6e2”)
.resources(http(“request_40”)
.get("/ui/css/azmind.com.style.css")
As you can see the _csrf field changes everything the page is accessed.
As a result my script is not working - this button is not getting clicked when the script is run.
I tried they following but it didn’t work either :-
.exec(http(“request_39”)
.post("/ui/login")
.headers(headers_0)
.check(regex(""“type=“hidden” name=“csrf" value="([\w=/.\d%±.$]*)””"").saveAs("_csrf"))
.formParam(“username”, “tina@hoardalot.com”)
.formParam(“password”, “tina”)
.formParam("_csrf", “_csrf”)
.resources(http(“request_40”)
.get("/ui/css/azmind.com.style.css")
Any ideas?
Am I not saving the hidden element in the right place?
Or is another element field required for this field to be saved?
Full script attached.
Thanks,
Tina.
RecordedSimulation.scala (12.7 KB)