问题描述
-
请求:
request:
我发送了一个获取" http请求,没有参数;
路径:http://192.168.22.139:8080/KSP
I send a "get" http request, has no parameters;
path: http://192.168.22.139:8080/KSP
响应:
<input id="username" type="text" name="username" required/>
<input id="password" type="password" name="password" required/>
<input type="hidden" name="lt" value="LT-697-vbNmm6NKOZ0cd7Wg1ywzbMKLa0DnOc" />
<input type="hidden" name="execution" value="e1s1" />
<input type="hidden" name="_eventId" value="submit" />
然后我添加两个XPath Extractor来获取lt
和execution
:
And I add two XPath Extractor to get lt
and execution
:
- 参考名称:
lt
;
xPath查询://*[@id="login"]/input[3]
- 参考名称:
execution
;
xPath查询://*[@id="login"]/input[4]
- reference name:
lt
;
xPath query://*[@id="login"]/input[3]
- reference name:
execution
;
xPath query://*[@id="login"]/input[4]
然后我用username/password/service/It/execution/_eventId
发送另一个请求:
Then I send another request with username/password/service/It/execution/_eventId
:
错误:票证和执行为空,我通过chrome获取了xpath,那是什么问题?
Error: ticket and execution I get is empty, I get the xpath by chrome, so what is the problem?
推荐答案
从第一个响应中,可以使用 Regular Expression Extractor 提取ticke和lt.
From the first response, can use Regular Expression Extractor to extract ticke and lt.
然后发送第二个带有参数的请求:
Then send the second request with parameter:
顺便说一句,您应该添加 HTTP Cookie Manager ,
By the way, you should add HTTP Cookie Manager,
这篇关于如何用jmeter测试CAS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!