一、場(chǎng)景
使用jmeter5.2.1的xpath提取器獲取請(qǐng)求響應(yīng)結(jié)果中值作為下一個(gè)請(qǐng)求的輸入,并在Bean Shell后置處理器中編寫(xiě)通過(guò)日志打印XPath提取器提取的內(nèi)容。
二、關(guān)鍵操作及選擇
提取內(nèi)容為請(qǐng)求響應(yīng)結(jié)果中的<input type="hidden" name="execution" value="a6cd.........................................................">
,需要提取的為value值,提取要后作為下一個(gè)請(qǐng)求的輸入。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-409986.html
【xpath提取器填寫(xiě)】:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-409986.html
- Apply to:選中Main sample and sub-samples
- XML Parsing Options:選中Use Tidy(tolerant parser)和Quiet
- 勾選Return entire XPath fragment of text content?
- 引用名稱:
execution_value_xpath
- XPath query:
//input[@type="hidden"][@name="execution"]/@value
- 匹配數(shù)字(0代表隨機(jī)):
-1
- 缺省值:
execution_val
到了這里,關(guān)于“jmeter使用xpath提取器獲取請(qǐng)求響應(yīng)中的value值作為下一個(gè)請(qǐng)求的輸入”案例的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!