且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jmeter中的相关性问题:所需的防伪表单字段"__RequestVerificationToken"不存在

更新时间:2022-05-09 00:06:22

在图片中,似乎以某种方式提取失败,或者您使用的是硬编码值而不是提取值.我建议使用调试采样器查看结果树侦听器组合,并确保您在HTTP请求中使用${RequestVerificationToken}.

Looking into the pictures it appears that somewhere somehow your extraction fails or you're using hard-coded value instead of extracted one. I would recommend double checking the extracted value using Debug Sampler and View Results Tree listener combination and ensuring you're using ${RequestVerificationToken} in the HTTP Request.

此外,如果变量以 HTTP Cookie 您可以直接从 HTTP Cookie管理器中获取它,例如:

Also if the variable comes as a HTTP Cookie you can get it directly from the HTTP Cookie Manager like:

  1. 将下一行添加到 user.properties 文件(位于JMeter安装的"bin"文件夹中)

  1. Add the next line to user.properties file (lives in "bin" folder of your JMeter installation)

CookieManager.save.cookies=true

  • 重新启动JMeter进行更改
  • 在需要的地方将cookie值引用为${COOKIE____RequestVerificationToken}.
  • Restart JMeter to pick up the change
  • Refer the cookie value as ${COOKIE____RequestVerificationToken} where required.
  • 更多信息: HTTP Cookie Manager高级用法-指南