将变量从一个 http 请求传递到 Jmeter 中的另一个 [英] Passing variable from one http request to another in Jmeter

查看:22
本文介绍了将变量从一个 http 请求传递到 Jmeter 中的另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将一个变量从 jmeter 中的 xpath 提取器传递给另一个 http 请求.
我该怎么做?

I have to pass a variable from an xpath extractor in jmeter to another http request.
How can I do this?

我想在 http 请求头中传递变量.
我已将 xpath 提取器中的变量保存为 LoginToken.
试图在第二个 http 请求的标头中检索为 ${LoginToken} 但它不起作用.

I want to pass the variable in header of http request.
I have saved the variable in xpath extractor as LoginToken.
Tried to retrieve in header of second http request as ${LoginToken} but it doesn't work.

推荐答案

  1. 首先确保您的 xpath 表达式确实返回任何结果.
    将 XPath Extractor 中的 Default Value 字段设置为任何值并使用例如Debug Sampler 查看 XPath Extractor 执行后 LoginToken 变量的值.
  2. 如果您使用 XPath Extractor 来解析 HTML 响应,请确保使用 Tidy(容忍解析器) 选项已选中.
  1. Ensure first that your xpath expression really returns any result.
    Set Default Value field in XPath Extractor to any value and use e.g. Debug Sampler to view the value of LoginToken variable after XPath Extractor execution.
  2. If you are using XPath Extractor to parse HTML response ensure that Use Tidy (tolerant parser) option is CHECKED.

这篇关于将变量从一个 http 请求传递到 Jmeter 中的另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆