问题
I have a page /login
after successful login we will be redirected to /files
How do I extract an information from /files
page? I use Jmeter as executor
- 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
回答1:
JMeter should follow the redirects given you provide follow-redirects: true property.
Also you will need to change the XPath Extractor's scope to sub-samples by adding the next line:
scope: children
You can always launch JMeter GUI by running the following command:
bzt your-test.yaml -gui
and Taurus will convert your YAML scenario into JMeter Test plan which can be easily launched and debugged.
More information: Navigating your First Steps Using Taurus
来源:https://stackoverflow.com/questions/62759416/extract-information-from-page-after-redirect-in-taurus