【问题标题】:Jmeter: " &lt; " in dynamic variableJmeter:动态变量中的“<”
【发布时间】:2017-02-13 19:34:28
【问题描述】:

Jmeter 新手。还在学习。任何帮助将不胜感激。

登录帖子请求: 获取https://exe.example.com/dsfs/ls/?wa=esignin1.0&trealm=https%3A%2F%2Fexe.example.com%2F&wctx=rm%3D1%26id%3D82339bbd-7cdb-4372-ae5f-65efd2dac185%26ru%3Dhttps%253a%252f%252fexample.com%252fdefault.aspx&wct=2014-05-08T17%3A47%3A46Z&wauth=urn%3Aoasis%3Anames%3Atc%3ASAML%3A1.0%3Aam%3Apassword

以上是我从之前的响应中获得的 wa、trealm、wctx、wct、wauth 的值的发布请求。 对于上述发布请求,我得到以下响应,其中包含一个隐藏变量“wresult”

<html><head>
<title>Working...</title>
</head>
<body>
<html><head><title>Working...</title></head><body>
<form method="POST" name="hiddenform" action="https://exe.example.com/">
<input type="hidden" name="wa" value="esignin1.0" />

<input type="hidden" name="wresult" value="&lt;t:RequestSecurityTokenResponse xmlns:t=&quot;http://schemas.xmlsoap.org/ws/2005/02/trust&quot;><t:Lifetim….…….../trust/Issue</t:RequestType><t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>" /> 

<input type="hidden" name="rctx" value="rm=1&amp;id=f71cbbfb-c9f6-4255-bb38-f9ec81f1d4aa&amp;ru=https%3a%2f%2fexample.com%2fdefault.aspx" />
<noscript><p>Script is disabled. Click Submit to continue.<input type="submit" value="Submit" /></noscript></form><script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script></body></html>

我必须在下一个请求中发送 wrestle 值。摔跤值应该如下所示。

<t:RequestSecurityTokenResponsexmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust<t:Lifetim……………entity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>

但是 wresult 值被发送为

&lt;t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"><t:Lifetim….….……entity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>" />

在浏览器中,我猜想某些东西将 "&amp;lt;" 替换为 "&lt;”没有被替换 jmeter中的“

谁能告诉我如何解决这个问题?

【问题讨论】:

    标签: variables dynamic jmeter


    【解决方案1】:

    JMeter 不执行任何 javascript 但您的浏览器执行! 所以你可能是对的!

    因此,在您的分析中,如果“

    http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor

    【讨论】:

    • 感谢您理解我的帖子,即使问题中有错误:) 我会尝试您的解决方案并回复您。再次感谢!!
    【解决方案2】:

    尝试在您的 HTTP 请求中使用“内容编码:”“UTF-8”或“iso-8859-1”。

    您还必须检查“编码?”中的参数?您的请求的列。

    希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      如果这是您遇到此问题的唯一地方,您可以通过使用以下代码添加 Beanshell Pre-Processor 来解决此问题:

      String wresult = vars.get("wresult").replaceAll("&lt;([^.]*?)", "<");
      vars.put("wresult",wresult);
      

      使用上面的代码添加 Beanshell 预处理器作为请求的子项,您尝试在其中传递 wresult 变量。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多