How to run "Login Scenario" on ADF web App


I’m trying to run the following scenario on an Oracle ADF web App

It’s only the login form of the App but it fails when I run the scenarion

this line seems suspicious to me :

.get(uri1 + “/security/pages/Login.jspx?_afrLoop=1805190504273000&_afrWindowMode=0&_afrWindowId=15ju479l2n_1”)))`


Any hints would be appreciated.

package pooya.intl.test.login

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.core.check.SaveAs
import io.gatling.core.check.SaveAs
import io.gatling.http.response.ResponseBody

class MyLogin extends Simulation {

val httpProtocol = http

.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0”)

val uri1 = “

val scn = scenario(“MyLogin”)
.get(uri1 + “/security/pages/Login.jspx?_afrLoop=1805190504273000&_afrWindowMode=0&_afrWindowId=15ju479l2n_1”)))

.formParam(“pt:username”, “admin”)
.formParam(“pt:password”, “123456”)
.formParam(“org.apache.myfaces.trinidad.faces.FORM”, “dataForm”)
.formParam(“javax.faces.ViewState”, “!-5zyl39i6n”)
.formParam(“event”, “pt:login”)
.formParam(“”, “”“action”"")
.get(uri1 + “/settingjavascriptservlet.js”),
.get(uri1 + “/jheadstart/images/go_ena.png”)
.get(uri1 + “/favicon.ico”)


I get the following error in the ADF app Log :

ADFc: While handling an exception the application’s exception handler threw a new exception.
javax.faces.application.ViewExpiredException: viewId:/security/pages/Login.jspx - ADF_FACES-30107:The view state of the page has expired. Reload the page.


ADF is based on JSF, that uses tokens to synchronize browser view state and server state. You have to capture those tokens in the page and send them back properly.

In .formParam(“javax.faces.ViewState”, “!-5zyl39i6n”)

!-5zyl39i6n is not a constant that you can set once and for all.

How can I capture that in a scenario ? can you please give me a sample code ? (I’m new to scala & gatling !)

That was a great help,Thank you.

there are also following parameters then need to be set, these are specifically for ADF.
How should I set these also ?!

``_afrLoop= &_afrWindowMode= &_afrWindowId=``


Usually you can capture data from response using checks. Depending upon how this information is in response body, you can either use regex parser or cssselector.

Go through the gatling tutorial (quickstart and advanced). Stephane & co. has covered capturing these scenarios. Without a good understanding of the tool you will be lost.