在金牛座中重定向后从页面中提取信息
问题内容:
/login
成功登录后我有一个页面,我们将被重定向到“ /files
如何从/files
页面提取信息” ?我使用Jmeter作为执行者
- url: '${host}/login'
method: POST
label: 'Login'
headers:
Upgrade-Insecure-Requests: '1'
Origin: 'null'
Content-Type: application/x-www-form-urlencoded
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'
extract-xpath:
requesttoken:
xpath: //head/@data-requesttoken
default: NOT_FOUND
validate-xml: false
ignore-whitespace: true
use-tolerant-parser: true
body:
password: pass
timezone: Europe/Berlin
timezone_offset: '2'
user: admin
问题答案:
如果您提供属性,
JMeter应该遵循重定向follow-redirects: true
。
另外,您还需要通过添加下一行将 XPath
Extractor的范围更改为子样本:
scope: children
您始终可以通过运行以下命令来启动JMeter GUI:
bzt your-test.yaml -gui
Taurus会将您的YAML方案转换为JMeter测试计划,该计划可以轻松启动和调试。
详细信息:使用Taurus导航您的第一步