代码之家  ›  专栏  ›  技术社区  ›  Jahongir Rahmonov

JMeter不替换正则表达式提取器中的引用变量

  •  0
  • Jahongir Rahmonov  · 技术社区  · 8 年前

    我正试图发送一个 POST 从JMeter请求我的登录url:

    enter image description here

    为了注入csrf令牌,我使用正则表达式提取器,它如下所示:

    enter image description here

    我可以确认正则表达式正在工作:

    enter image description here

    然而 ${token} 未被替换:

    enter image description here

    可能有什么问题?

    enter image description here

    1 回复  |  直到 8 年前
        1
  •  1
  •   Dmitri T    8 年前
    1. 正则表达式提取器(以及任何其他 Post-Processors )跟随 Scoping Rules 返回此值的请求的
    2. Using regular expressions to parse HTML is not the best idea (它们太脆弱,对任何标记更改都很敏感),我建议切换到 CSS/JQuery Extractor

      • 参考名称: token
      • CSS/JQuery表达式: input[name=csrfmiddlewaretoken]
      • value