How to disableUrlencoding

Hello All,

I have a challenge in gatling scripting. while logging in to the application, it has password and password encrypted field. The password field is empty and password encrypted has some value. In loadrunner, i deleted password encrypted field and passed the password in the password field. it worked fine.

I implemented the same in gatling but observed an error (403). I observed one more. XSRF and password is passed with encoding. I suspect that could be the issue (i am not sure. Please guide me.

I implemented .disableurlencoding as well. but still the same. might be in wrong place.

Hello @rekha,

Without you providing a SCCE, and explain what you already tried, we cannot help you.

Password encryption and form encoding is specific from one application to another.

Keep in mind that Gatling does not execute frontend code (no Javascript execution).

Cheers!

package Package.Action
//Packagename.Folder  here leadIT is the package name and Action is the folder

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.core.structure.ChainBuilder
import io.gatling.http.request.builder.HttpRequestBuilder.toActionBuilder
import io.gatling.http.response._
import io.gatling.commons.stats.Status
import java.time.LocalDate
import java.time.temporal.ChronoUnit
import java.util.Calendar
import java.text.SimpleDateFormat

object CPMS_Action
{

  val httpProtocol = http
    .baseUrl("https://${URL}")
    .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.woff2""", """.*\.(t|o)tf""", """.*\.png""", """.*detectportal\.firefox\.com.*"""), WhiteList())

  
  val headers_7 = Map(
    "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "Accept-Encoding" -> "gzip, deflate, br",
    "Accept-Language" -> "en-US,en;q=0.9",
    "Sec-Fetch-Dest" -> "document",
    "Sec-Fetch-Mode" -> "navigate",
    "Sec-Fetch-Site" -> "none",
    "Sec-Fetch-User" -> "?1",
    "Upgrade-Insecure-Requests" -> "1",
    "User-Agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows")

  val headers_9 = Map(
    "accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-encoding" -> "gzip, deflate, br",
    "accept-language" -> "en-US,en;q=0.9",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows",
    "sec-fetch-dest" -> "document",
    "sec-fetch-mode" -> "navigate",
    "sec-fetch-site" -> "none",
    "sec-fetch-user" -> "?1",
    "upgrade-insecure-requests" -> "1",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

  val headers_14 = Map(
    "accept" -> "application/json, text/plain, */*",
    "accept-encoding" -> "gzip, deflate, br",
    "accept-language" -> "en-US,en;q=0.9",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows",
    "sec-fetch-dest" -> "empty",
    "sec-fetch-mode" -> "cors",
    "sec-fetch-site" -> "same-origin",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

  val headers_15 = Map(
    "accept" -> "*/*",
    "accept-encoding" -> "gzip, deflate",
   // "content-type" -> "application/x-www-form-urlencoded",
    "accept-language" -> "en-US,en;q=0.9",
    "origin" -> "https://${LoginURL}",
    //"sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    //"sec-ch-ua-mobile" -> "?0",
    //"sec-ch-ua-platform" -> "Windows",
    //"sec-fetch-dest" -> "document",
    //"sec-fetch-mode" -> "navigate",
    //"sec-fetch-site" -> "same-origin",
    //"sec-fetch-user" -> "?1",
    //"upgrade-insecure-requests" -> "1",
    "cookie" -> "XSRF-TOKEN=${CPMSHeaderXSRF}",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

//  val headers_15 = Map(
//    "accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
//    "accept-encoding" -> "gzip, deflate, br",
//    "accept-language" -> "en-US,en;q=0.9",
//    "origin" -> "https://${LoginURL}",
//    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
//    "sec-ch-ua-mobile" -> "?0",
//    "sec-ch-ua-platform" -> "Windows",
//    "sec-fetch-dest" -> "document",
//    "sec-fetch-mode" -> "navigate",
//    "sec-fetch-site" -> "same-origin",
//    "sec-fetch-user" -> "?1",
//    "upgrade-insecure-requests" -> "1",
//    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")


 


  val uri5 = "https://${LoginURL}"


  // val scn = scenario("CPMS01")

  def CPMS_HomePage_Get (): ChainBuilder = {
    group("01_CPMS_01_HomePage") {
      //exec(_.set("PerfID", random.toString))
      exec(http("CPMS_01_HomePage")
        .get("https://${URL}/cpms")
        .check(status.in(expected = 200, 201, 302))
        .check(regex(""""_csrf" value="([^"]*)"""")
          .saveAs("Corrcsrf"))
        .check(regex("pingResume=/as/(.*?)/resume").find.saveAs("corrPingResume"))
        .check(headerRegex("Set-Cookie", """XSRF-TOKEN=(.*?);""").ofType[(String, String)]
          .saveAs("CPMSHeaderXSRF"))

        .headers(headers_7)
        .check(status.saveAs("HomePageStatusCode")))
        .doIf(session => session("HomePageStatusCode").as[String] == "401,403,402,404,500,501,503,505") {
          exec(session => {
            println("CPMS01_HomePage Failed -due to different Status code")
            session
          })
        }.exitHereIfFailed


//        .exec(http("HomePage1")
//          //.get(s"https://${LoginURL}/?instance=default&resumePath=%2Fas%2FBQmReJdEKV%2Fresume%2Fas%2Fauthorization.ping&allowInteraction=true&reauth=false&connectionId=1cc33162-ba0c-403a-80e9-dcf5fec36617&REF=8A0D34890C2679CCFF649A3344FD8869DD4CA9A0624E556F6ABA000000CA&unique_id=Y2sx7sI28q0cmMZyKsYkWwAAAQ4&scope=openid&client_id=1cc33162-ba0c-403a-80e9-dcf5fec36617&dc=str2")
//          .get("https://${LoginURL}/")
//          .headers(headers_9)
//          resources(http("request_10")
//          .get("https://${LoginURL}/pub/img/Daimler_Product_Brands_WEBP/brands_b_1920-131757d1b56000659127189dfe4f88ae.webp"),
//          http("request_11")
//            .get("https://${LoginURL}/pub/img/img_assets_sprite_svg.svg"),
//          http("request_12")
//            .get("https://${LoginURL}/pub/brands/default/img/logo.svg"),
//          http("request_13")
//            .get("https://${LoginURL}/pub/fonts/Daimler_Iconset-Basic_04.ttf?imiani")))
    }
  }



    //Login


  def CPMS_Login_Get(): ChainBuilder = {
    group("01_CPMS_02_Login") {
      exec(http("Login")
        .get("https://${LoginURL}/time")
        .check(status.in(expected = 200, 201, 302))
        .headers(headers_14)

        .resources(http("request_15")
          .post("https://${LoginURL}/")
          .headers(headers_15)
          //.formParam("_csrf", "8f4de5ff-efeb-4e01-9b03-2fa520668258")
          .formParam("_csrf", "${CPMSHeaderXSRF}")
          .formParam("username", "PADGOLI")
          .formParam("pingRefId", "true")
          .formParam("scope", "openid")
          .formParam("dc", "str2")
          .formParam("pingResume", "/as/${corrPingResume}/resume/as/authorization.ping")
          .formParam("instance", "default")
          .formParam("password", "Padmava@11"),
          //.formParam("password-encrypted", "ELVvB1KFC5vSXlysihddBns28TDlbIx5sWtFZv6ubVBb5yK2rdUgtq/D9/F/32+xIRP1Y+LcHyhSGe+PgfJ6SgjMm4yDJOA+2A4xpBHkRCDkotgb4rTl8toDCd8LPt+vqybt7hOS83ivk7LjDc3+CznfXPaCjLRvlHahvhtuWPJpWz83Qv0NHIX9p5JSKIjh8bfzxY3wcXunnFqyHrDwITq3Y/7eVjJ5BorgxyvYPc5MYqNo1XZGGcQGaaGYGqJGNsfphATPuXnpmgGOwu4MFLfbcDFLE438dn4fJZ7JQ7M2ZGv+UaeG7GFpSie+YnWafV/Vgmhy9YjB3ntOBGVlIg=="),
          //
          http("request_50")
            .get("https://${URL}/cpms/forms/login/logon.jsp")
            .check(status.in(expected = 200, 201, 302))
            .headers(headers_45),
          http("request_51")
            .post("https://${URL}/cpms/handler?1667969539101")
            .headers(headers_51)
            .formParam("source", "logon.jsp")
            .formParam("event", "Login")
            .formParam("MDAT", "DEF")
            .formParam("dbKI", "PADGOLI"))

        .check(status.saveAs("CPMS01_LoginStatusCode")))
        .doIf(session => session("CPMS01_LoginStatusCode").as[String] == "401,403,402,404,500,501,503,505") {
          exec(session => {
            println("CPMS01_Login  Failed -due to different Status code")
            session
          })
        }.exitHereIfFailed
    }
  }
    //

   }

How is this a SCCE?

  • Simple => please remove all dead code that are only noises.
  • Correct => What is URL? How can I test that?
  • Compilable => Didn’t try it, but seems compilable
  • Executable => It’s not even a Simulation class.

Please, be kind to others that try to help you.

This is a scenario.

package Package.Scenerio
//Packagename.ScenerioFolder
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import Package.Action._
import io.gatling.core.structure.ChainBuilder
import io.gatling.http.request.builder.HttpRequestBuilder.toActionBuilder

object CPMS_Scenario {
  // val domainURL = "https://mylead-test.app.corpintra.net"
  val CPMSScenario1 = scenario("S03_CPMSScenario").repeat(1) { // iteration
    //  val artScenario1 = scenario("S01_ArtScenario").forever() { // iteration
    // val artScenario1 = scenario("S01_Art_Scenerio").forever() {// infinite time till the duration ends

    val pUserName = csv("credentials.csv").circular
    val pPassWord = csv("credentials1.csv").circular
    //  val pFilterName = csv("Filters.csv").random

    tryMax(1) // tryMax is like session exit  -  it tries
    {
      exec(flushSessionCookies)
        .exec(flushCookieJar)
        // .exec(_.set("AppUrl",domainURL))
        .feed(pUserName) //.feed(feedername)
        .feed(pPassWord)
        .exec(CPMS_Action.CPMS_HomePage_Get().pause(5)) //think time
        .exec(CPMS_Action.CPMS_Login_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_ChangeLang_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_AddModifyFilter_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_FilterSaveAs_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_ActivateFilter_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_EditMode_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_NextTree_Get().pause(5))
      //        .exec(CPMS_Action.CPMS_Exit_Get().pause(5))
    }
  }
}

This is simulation

package Package.Simulation
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.core.structure.ChainBuilder
import io.gatling.http.request.builder.HttpRequestBuilder.toActionBuilder
import Package.Scenerio._  //Packagename.Scenariofoldername
import Package.Action._ //Packagename.ActionFoldername


class CPMS_Simulation  extends Simulation {

  val httpProtocol = http
    .disableCaching
   // .disableUrlEncoding

  setUp(
    //ScenarioOjectName.ScenerioVariableName
    CPMS_Scenario.CPMSScenario1.inject(
      atOnceUsers(1))
//      rampConcurrentUsers(1) to (1) during (6.seconds),
//      constantConcurrentUsers(1) during (20.seconds),
//      rampConcurrentUsers(1) to (1) during (6.seconds))
      .protocols(httpProtocol)
  )


}
//  .maxDuration(360)

//ScenarioObjectName.ScenarioVariableName
/*setUp(
  S01_Art_Scenerio.artScenario1.inject(
 //   nothingFor(5),
  /*  atOnceUsers(10),*/
 //   rampUsers(2) during(10))//one vUser every 1 second - during is ramp up time

    rampConcurrentUsers(1) to(5) during(600.seconds),
    constantConcurrentUsers(5) during (1200.seconds),
    rampConcurrentUsers(5) to(1) during(600.seconds))
    .protocols(httpProtocol)
)
//  .maxDuration(360)
}
 */

This is action…

package Package.Action
//Packagename.Folder  here leadIT is the package name and Action is the folder

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.core.structure.ChainBuilder
import io.gatling.http.request.builder.HttpRequestBuilder.toActionBuilder
import io.gatling.http.response._
import io.gatling.commons.stats.Status
import java.time.LocalDate
import java.time.temporal.ChronoUnit
import java.util.Calendar
import java.text.SimpleDateFormat

object CPMS_Action
{

  val httpProtocol = http
    .baseUrl("https://mylead-test.app.corpintra.net")
    .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.woff2""", """.*\.(t|o)tf""", """.*\.png""", """.*detectportal\.firefox\.com.*"""), WhiteList())

 

  val headers_6 = Map(
    "accept" -> "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
    "accept-encoding" -> "gzip, deflate, br",
    "accept-language" -> "en-US,en;q=0.9",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows",
    "sec-fetch-dest" -> "image",
    "sec-fetch-mode" -> "no-cors",
    "sec-fetch-site" -> "cross-site",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

  val headers_7 = Map(
    "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "Accept-Encoding" -> "gzip, deflate, br",
    "Accept-Language" -> "en-US,en;q=0.9",
    "Sec-Fetch-Dest" -> "document",
    "Sec-Fetch-Mode" -> "navigate",
    "Sec-Fetch-Site" -> "none",
    "Sec-Fetch-User" -> "?1",
    "Upgrade-Insecure-Requests" -> "1",
    "User-Agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows")

  val headers_9 = Map(
    "accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-encoding" -> "gzip, deflate, br",
    "accept-language" -> "en-US,en;q=0.9",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows",
    "sec-fetch-dest" -> "document",
    "sec-fetch-mode" -> "navigate",
    "sec-fetch-site" -> "none",
    "sec-fetch-user" -> "?1",
    "upgrade-insecure-requests" -> "1",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

  val headers_14 = Map(
    "accept" -> "application/json, text/plain, */*",
    "accept-encoding" -> "gzip, deflate, br",
    "accept-language" -> "en-US,en;q=0.9",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows",
    "sec-fetch-dest" -> "empty",
    "sec-fetch-mode" -> "cors",
    "sec-fetch-site" -> "same-origin",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

  val headers_15 = Map(
    "accept" -> "*/*",
    "accept-encoding" -> "gzip, deflate",
   // "content-type" -> "application/x-www-form-urlencoded",
    "accept-language" -> "en-US,en;q=0.9",
    "origin" -> "https://login-int.mercedes-benz.com",
    //"sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    //"sec-ch-ua-mobile" -> "?0",
    //"sec-ch-ua-platform" -> "Windows",
    //"sec-fetch-dest" -> "document",
    //"sec-fetch-mode" -> "navigate",
    //"sec-fetch-site" -> "same-origin",
    //"sec-fetch-user" -> "?1",
    //"upgrade-insecure-requests" -> "1",
    "cookie" -> "XSRF-TOKEN=${CPMSHeaderXSRF}",
    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")

//  val headers_15 = Map(
//    "accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
//    "accept-encoding" -> "gzip, deflate, br",
//    "accept-language" -> "en-US,en;q=0.9",
//    "origin" -> "https://login-int.mercedes-benz.com",
//    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
//    "sec-ch-ua-mobile" -> "?0",
//    "sec-ch-ua-platform" -> "Windows",
//    "sec-fetch-dest" -> "document",
//    "sec-fetch-mode" -> "navigate",
//    "sec-fetch-site" -> "same-origin",
//    "sec-fetch-user" -> "?1",
//    "upgrade-insecure-requests" -> "1",
//    "user-agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42")


  val headers_16 = Map(
    "Accept" -> "text/css,*/*;q=0.1",
    "Accept-Encoding" -> "gzip, deflate, br",
    "Accept-Language" -> "en-US,en;q=0.9",
    "Sec-Fetch-Dest" -> "style",
    "Sec-Fetch-Mode" -> "no-cors",
    "Sec-Fetch-Site" -> "same-origin",
    "User-Agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows")

  val headers_27 = Map(
    "Accept" -> "*/*",
    "Accept-Encoding" -> "gzip, deflate, br",
    "Accept-Language" -> "en-US,en;q=0.9",
    "Origin" -> "https://mylead-test.app.corpintra.net",
    "Sec-Fetch-Dest" -> "script",
    "Sec-Fetch-Mode" -> "cors",
    "Sec-Fetch-Site" -> "same-origin",
    "User-Agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows")

  val headers_28 = Map(
    "Accept" -> "*/*",
    "Accept-Encoding" -> "gzip, deflate, br",
    "Accept-Language" -> "en-US,en;q=0.9",
    "Sec-Fetch-Dest" -> "script",
    "Sec-Fetch-Mode" -> "no-cors",
    "Sec-Fetch-Site" -> "same-origin",
    "User-Agent" -> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
    "sec-ch-ua" -> """Chromium";v="106", "Microsoft Edge";v="106", "Not;A=Brand";v="99""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "Windows")



  val uri5 = "https://login-int.mercedes-benz.com"


  // val scn = scenario("CPMS01")

  def CPMS_HomePage_Get (): ChainBuilder = {
    group("01_CPMS_01_HomePage") {
      //exec(_.set("PerfID", random.toString))
      exec(http("CPMS_01_HomePage")
        .get("https://mylead-test.app.corpintra.net/cpms")
        .check(status.in(expected = 200, 201, 302))
        .check(regex(""""_csrf" value="([^"]*)"""")
          .saveAs("Corrcsrf"))
        .check(regex("pingResume=/as/(.*?)/resume").find.saveAs("corrPingResume"))
        .check(headerRegex("Set-Cookie", """XSRF-TOKEN=(.*?);""").ofType[(String, String)]
          .saveAs("CPMSHeaderXSRF"))

        .headers(headers_7)
        .check(status.saveAs("HomePageStatusCode")))
        .doIf(session => session("HomePageStatusCode").as[String] == "401,403,402,404,500,501,503,505") {
          exec(session => {
            println("CPMS01_HomePage Failed -due to different Status code")
            session
          })
        }.exitHereIfFailed


//        .exec(http("HomePage1")
//          //.get(s"https://login-int.mercedes-benz.com/?instance=default&resumePath=%2Fas%2FBQmReJdEKV%2Fresume%2Fas%2Fauthorization.ping&allowInteraction=true&reauth=false&connectionId=1cc33162-ba0c-403a-80e9-dcf5fec36617&REF=8A0D34890C2679CCFF649A3344FD8869DD4CA9A0624E556F6ABA000000CA&unique_id=Y2sx7sI28q0cmMZyKsYkWwAAAQ4&scope=openid&client_id=1cc33162-ba0c-403a-80e9-dcf5fec36617&dc=str2")
//          .get("https://login-int.mercedes-benz.com/")
//          .headers(headers_9)
//          resources(http("request_10")
//          .get("https://login-int.mercedes-benz.com/pub/img/Daimler_Product_Brands_WEBP/brands_b_1920-131757d1b56000659127189dfe4f88ae.webp"),
//          http("request_11")
//            .get("https://login-int.mercedes-benz.com/pub/img/img_assets_sprite_svg.svg"),
//          http("request_12")
//            .get("https://login-int.mercedes-benz.com/pub/brands/default/img/logo.svg"),
//          http("request_13")
//            .get("https://login-int.mercedes-benz.com/pub/fonts/Daimler_Iconset-Basic_04.ttf?imiani")))
    }
  }



    //Login


  def CPMS_Login_Get(): ChainBuilder = {
    group("01_CPMS_02_Login") {
      exec(http("Login")
        .get("https://login-int.mercedes-benz.com/time")
        .check(status.in(expected = 200, 201, 302))
        .headers(headers_14)

        .resources(http("request_15")
          .post("https://login-int.mercedes-benz.com/")
          .headers(headers_15)
          //.formParam("_csrf", "8f4de5ff-efeb-4e01-9b03-2fa520668258")
          .formParam("_csrf", "${CPMSHeaderXSRF}")
          .formParam("username", "PADGOLI")
          .formParam("pingRefId", "true")
          .formParam("scope", "openid")
          .formParam("dc", "str2")
          .formParam("pingResume", "/as/${corrPingResume}/resume/as/authorization.ping")
          .formParam("instance", "default")
          .formParam("password", "Padmava@11"),
          //.formParam("password-encrypted", "ELVvB1KFC5vSXlysihddBns28TDlbIx5sWtFZv6ubVBb5yK2rdUgtq/D9/F/32+xIRP1Y+LcHyhSGe+PgfJ6SgjMm4yDJOA+2A4xpBHkRCDkotgb4rTl8toDCd8LPt+vqybt7hOS83ivk7LjDc3+CznfXPaCjLRvlHahvhtuWPJpWz83Qv0NHIX9p5JSKIjh8bfzxY3wcXunnFqyHrDwITq3Y/7eVjJ5BorgxyvYPc5MYqNo1XZGGcQGaaGYGqJGNsfphATPuXnpmgGOwu4MFLfbcDFLE438dn4fJZ7JQ7M2ZGv+UaeG7GFpSie+YnWafV/Vgmhy9YjB3ntOBGVlIg=="),
          //
          http("request_50")
            .get("https://mylead-test.app.corpintra.net/cpms/forms/login/logon.jsp")
            .check(status.in(expected = 200, 201, 302))
            .headers(headers_45),
          http("request_51")
            .post("https://mylead-test.app.corpintra.net/cpms/handler?1667969539101")
            .headers(headers_51)
            .formParam("source", "logon.jsp")
            .formParam("event", "Login")
            .formParam("MDAT", "DEF")
            .formParam("dbKI", "PADGOLI"))

        .check(status.saveAs("CPMS01_LoginStatusCode")))
        .doIf(session => session("CPMS01_LoginStatusCode").as[String] == "401,403,402,404,500,501,503,505") {
          exec(session => {
            println("CPMS01_Login  Failed -due to different Status code")
            session
          })
        }.exitHereIfFailed
    }
  }
    //

    .pause(8)

  def CPMS_ChangeLang_Get (): ChainBuilder = {
    group("01_CPMS_03_ChangeLang") {
      exec(http("ChangeLang")
        .get("https://mylead-test.app.corpintra.net/cpms/default.jsp?lang=2")
        .check(status.in(expected = 200, 201, 302))
        .headers(headers_58)
        .resources(http("request_59")
          .get("https://mylead-test.app.corpintra.net/cpms/include/workbench/core/6.9.3/css/globals.css?v=RC12.0.0")
          .headers(headers_16),
          http("request_68")
            .get("https://mylead-test.app.corpintra.net/cpms/include/timeHandler/timeHandler.js?v=RC12.0.0")
            .headers(headers_28),
          http("request_88")
            .get("https://mylead-test.app.corpintra.net/cpms/blank.jsp")
            .headers(headers_45),
          http("request_89")
            .get("https://mylead-test.app.corpintra.net/cpms/blank.jsp")
            .headers(headers_45),
          http("request_90")
            .get("https://mylead-test.app.corpintra.net/cpms/blank.jsp")
            .headers(headers_45),
          http("request_91")
            .get("https://mylead-test.app.corpintra.net/cpms/blank.jsp")
            .headers(headers_45),
          http("request_92")
            .get("https://mylead-test.app.corpintra.net/cpms/blank.jsp")
            .headers(headers_45),
          http("request_93")
            .get("https://mylead-test.app.corpintra.net/cpms/forms/login/logon.jsp")
            .headers(headers_45),
          http("request_94")
            .post("https://mylead-test.app.corpintra.net/cpms/handler?1667969552271")
            .headers(headers_51)
            .formParam("source", "logon.jsp")
            .formParam("event", "Login")
            .formParam("MDAT", "DEF")
            .formParam("dbKI", "PADGOLI"))
        .check(status.saveAs("CPMS01_ChangeLang")))
        .doIf(session => session("CPMS01_ChangeLang").as[String] == "401,403,402,404,500,501,503,505") {
          exec(session => {
            println("CPMS01_ChangeLang  Failed -due to different Status code")
            session
          })
        }.exitHereIfFailed
    }
  }


 
}

I haven’t received a response. We are doing a poc on Gatling. Please respond

Hi @rekha,

This community forum run in our free time, there is no SLA of any kind here.
In other hand, if you don’t receive any answer, perhaps it’s because your last post is not usable?

Is it really actionnable?

  • formatting: As you didn’t correctly format your posts, it’s hard to read it.
  • SCCE?
    • Simple: Your code is not simple as it contains too many thing foreign to the issue at hand
    • Executable: it references a server that is not reachable.

Because of all these, I, personally, don’t want to spend my free time to try to understand your particular issue, more when it’s more likely to be related to your specific server that is not reachable.

As I already wrote, be kind to the ones that try to help you.
Help others to help you.

1 Like

@rekha The way you are capturing your cookie value is wrong.

Your regex check is actually capturing (ACTUAL_COOKIE_VALUE);, that gives once %28ACTUAL_COOKIE_VALUE%2C%29 encoded, as visible in your first screen capture.

headerRegex(“Set-Cookie”, “”“XSRF-TOKEN=(.*?);”“”).ofType[(String, String)]

This is wrong. You shouldn’t have .ofType[(String, String)] which is when you have 2 capture groups, which you don’t.

And then you shouldn’t try to capture Set-Cookie headers. You should let Gatling capture it for you, and then use getCookieValue.

exec(getCookieValue(CookieKey("XSRF-TOKEN").saveAs("CPMSHeaderXSRF")))

You’re lucky that I was able to spot the error. As @sbrevet explained, your way more likely to get help if you provide a reproducer other people can run and that’s trimmed down to the essential pieces. Volunteers can’t be expected to look for a needle in a haystack.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.