Gatling脚本中未定义的变量

Gatling脚本中未定义的变量,gatling,Gatling,我是加特林的新手。我试图使用下面的css选择器检查我页面的html。css项出现在页面上(由邮递员验证),但盖特林找不到它。我在编译时收到一个变量未定义错误。如有任何建议,将不胜感激 import scala.concurrent.duration._ import io.gatling.core.Predef._ import io.gatling.http.Predef._ import io.gatling.jdbc.Predef._ class LoggingIn extends S

我是加特林的新手。我试图使用下面的css选择器检查我页面的html。css项出现在页面上(由邮递员验证),但盖特林找不到它。我在编译时收到一个变量未定义错误。如有任何建议,将不胜感激

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

class LoggingIn extends Simulation {

    val httpProtocol = http
        .baseURL("https://test.spidastudio.com")
        .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.(t|o)tf""", """.*\.png"""), WhiteList())

    val headers_0 = Map(
        "User-Agent"-> "Gatling",
        "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Encoding" -> "gzip, deflate",
        "Cache-Control" -> "max-age=0",
        "Origin" -> "https://test.spidastudio.com",
        "Upgrade-Insecure-Requests" -> "1")

    val headers_1 = Map("User-Agent"-> "Gatling","X-Requested-With" -> "XMLHttpRequest")

    val uri1 = "https://test.spidastudio.com"



    val scn = scenario("LoggingIn")
        .exec(http("REQUEST A")
            .post("/cas/login?service=https%3A%2F%2Ftest.spidastudio.com%2Fprojectmanager%2Fj_spring_cas_security_check")

            //Defining variable LTValue
            .check(css("input[name=lt]", "value").saveAs("LTValue"))
        )
        .exec(http("request_0")
            .post("/cas/login?service=https%3A%2F%2Ftest.spidastudio.com%2Fprojectmanager%2Fj_spring_cas_security_check")

            .headers(headers_0) 
            .formParam("username", "xxxxxxx.com")
            .formParam("password", "xxxxxxxx")
            //Calling variable
            .formParam("lt", "${LTValue}")

您是否尝试过从代码中删除这一行

.inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.(t|o)tf""", """.*\.png"""), WhiteList())

或者删除*.css“”?有效?

“我在编译时收到一个变量未定义错误”…代码未编译?“css项出现在页面上”-这无关紧要-或者?编译错误怎么办?