如何在 jmeter 中使用 CSS 选择器提取部分 href

how to extract part of href using CSS selector in jmeter

    <html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/Modules/Search/Search.aspx?code=ddaed8994a56a0a655976eb64946e861b2d5a5e391d1b62f83e19b3f6b224db4&amp;scope=openid%20api1&amp;state=8048c94b1f804d379fc295732852fdd6&amp;session_state=AI9280sswK6JzNkTRH5pz-sk3aci7S16KuYoiEyzhF0.737be1ce76d0c83a60b3c2c06a45564c&amp;ClientId=webform&amp;AspxAutoDetectCookieSupport=1">here</a>.</h2>
</body></html>

在上面的 html 响应中,我如何提取代码、范围、session_state 值。这些值本质上是动态的。有人可以在这里帮助我吗?我在下面尝试过: a:contain(代码)/a:containsOwn(代码)/ a[href*='code'] 使用上述技巧仅在此处给出结果。

我认为您不能使用 CSS Selector Extractor 来提取 href attribute, you can only get the full value, moreover your syntax is not correct, see CSS Selector Reference 文章的一部分以获取更多详细信息。

我宁愿建议使用 Boundary Extractor,它基本上提取“左”和“右”边界之间的所有内容,因此您可以执行以下操作:

更多信息:The Boundary Extractor vs. the Regular Expression Extractor in JMeter