# Please I need help to resolve this error: Failed to build request get login page: No attribute named 'User' is defined

**URL:** <https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452>\
**Category:** Gatling (Open-Source)\
**Created:** [August 16, 2018, 2:07pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452 "2018-08-16T14:07:40Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 16, 2018, 2:07pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/1 "2018-08-16T14:07:40Z")

</div>

Hi All,

I am new to Gatling. Please I need help to resolve the error mentioned above. I could see result for “Login page”, “News” and “News\_redirect”. However, the post request “Login” does not appear to work. It gives the above error.

I want this script to pick staff username and password from staff.csv file to login and then go to News page for 50 users. Thank you

val headers\_1 = Map(“Accept” → “_/_”)

val feeder = csv(“staff.csv”).random

val scn = scenario(“Login page”)

.feed(feeder)  
.exec(http(“Login page”)  
.get("/login/")  
.headers(headers\_1)  
.check(status.is(200),  
regex(""“input type=“hidden” name=“security” class=“js-csrf-token” id=“security” value=”([^"]\*)""").  
find.saveAs(“securityToken”)))

.pause(11)

.exec(http(“get login”)

.post("/login/")  
.formParam(“username”, “${User}”)  
.formParam(“password”, “${Pass}”)  
.formParam(“submit”, “Sign in”)  
.formParam(“security”, “${securityToken}”)  
.check(regex(“securityToken”))  
.body(StringBody("""{ “${User}” }""")))  
.pause(5)

.exec(http(“News”)  
.get("/news/")  
.headers(headers\_1))  
.pause (3)

setUp(scn.inject(atOnceUsers(50)).protocols(httpProtocol))

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 16, 2018, 3:20pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/2 "2018-08-16T15:20:25Z")

</div>

I think the problems is with feeder.  
At your csv file, in the first row and column has the value ‘User’?

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 16, 2018, 3:38pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/3 "2018-08-16T15:38:48Z")

</div>

I meant the value ‘User’ at the first line.  
Look at

[https://gatling.io/docs/current/advanced\_tutorial/#step-03-use-dynamic-data-with-feeders-and-checks](https://gatling.io/docs/current/advanced_tutorial/#step-03-use-dynamic-data-with-feeders-and-checks)

---

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 16, 2018, 4:15pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/4 "2018-08-16T16:15:40Z")

</div>

Thanks Lavio,  
Which of the csv format is correct? no space in between the values except commas. The second one has its values on separate columns.

I have tested with both but still have the same problem.

I look forward to hearing from you soon.

Thanks

Regards,  
G

![user2 - Copy.PNG](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/3a9a80e1050821799803905ccda22df5122dd8a3.png)

![user.PNG](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/1d61b533ce671fce8f90d2d5f5af03583761c8f2.png)

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 16, 2018, 4:22pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/5 "2018-08-16T16:22:33Z")

</div>

The problem is that you don’t know the first line is the label of data, I think you should do this

![image.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/7247b1770822980ebb5f04558f8fc5b37c459522.png)

---

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 16, 2018, 4:34pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/6 "2018-08-16T16:34:42Z")

</div>

This was exactly how it was before I posted the question to the group.

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 16, 2018, 4:38pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/7 "2018-08-16T16:38:09Z")

</div>

I’m new to gatling too. I don’t have more suggestions.

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 16, 2018, 5:10pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/8 "2018-08-16T17:10:27Z")

</div>

My csv

cpf,senha,uo  
84415237622,dataprev,UO:11001020  
84353873210,dataprev,UO:11001020

Code (it’s working)

object GERID {

val usuario = csv(“usuarios.csv”)  
val login = exec(http(“HOME SIBE”)  
.get("/PortalSibe/pages/index.xhtml")  
.headers(headers\_0)  
.check(regex(“Acesso via Senha”),  
css(“input[name=lt]”, “value”).saveAs(“lt”),  
css(“input[name=execution]”, “value”).saveAs(“execution”))  
.check(bodyString.saveAs(“responseBody”)))  
//.exec { session =\> println(session(“responseBody”).as[String]); session }  
.feed(usuario)  
.pause(1)  
.exec(http(“LOGIN GERID”)  
.post(uri1 + “?service=http%3A%2F%2Fhsibepuapr01%2FPortalSibe%2Fpages%2Findex.xhtml”)  
.headers(headers\_1)  
.formParam(“username”, “${cpf}”)  
.formParam(“password”, “${senha}”)  
.formParam(“lt”, “${lt}”)  
.formParam(“execution”, “${execution}”)  
.formParam("\_eventId", “submit”)  
.formParam(“submit”, “Entrar”)

.check(bodyString.saveAs(“responseBody”)))

---

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 16, 2018, 5:25pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/9 "2018-08-16T17:25:57Z")

</div>

Ok thanks a lot. I will check this out.

---

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 21, 2018, 4:12pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/10 "2018-08-21T16:12:09Z")

</div>

Hello Flavio,

This is still not working.

```auto
val scn = scenario("NewDevTest")

  .exec(http("Get Login Page")
    .get("/auth/login/")
    .headers(headers_2)
  .check(
  regex("""input type="hidden" name="security" class="js-csrf-token" id="security" value="([^"]*)""").find.saveAs("securityToken")))
  .pause(5)

  .feed(feeder)
exec(http("Login")
  .post("/auth/login/")
  .formParam("username", "${username}")
  .formParam("password", "${Password}")
  .formParam("submit", "Sign in")
  .formParam("security", "${securityToken}")
  .check(regex("get login page"))
  .body(StringBody("""{ "${username}" }""")))
pause(6)

```

---

<div class="post-metadata">

**Author:** ![Flavio\_da\_Silveira\_P](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Flavio\_da\_Silveira\_P](https://community.gatling.io/u/Flavio_da_Silveira_P)\
**Post date:** [August 22, 2018, 10:23am UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/11 "2018-08-22T10:23:01Z")

</div>

I don’t know what is your error but it could be the check.  
exec(http(“Get Login Page”)  
.get("/auth/login/")  
.headers(headers\_2)  
.check(  
**css(“input[name=security]”, “value”).saveAs(“securityToken”)))**

.pause(5)

---

<div class="post-metadata">

**Author:** ![Good\_girl](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@Good\_girl](https://community.gatling.io/u/Good_girl)\
**Post date:** [August 22, 2018, 3:16pm UTC](https://community.gatling.io/t/please-i-need-help-to-resolve-this-error-failed-to-build-request-get-login-page-no-attribute-named-user-is-defined/4452/12 "2018-08-22T15:16:21Z")

</div>

Hi Flavio,

I managed to fix it. The line below was not necessary and was embedded as part of the exec(Login) .check(regex(“get login page”))
