简体   繁体   English

JMeter-使用Xpath验证多个元素

[英]JMeter - validate multiple elements using Xpath

I get a XML like: 我得到一个类似的XML:

...
<TargetEle>12356   <TargerEle>
...
<TargetEle>123dagih   <TargerEle>
...

Can Xpath assertion verify whether all the values of tag "TargetEle" start with "123"? Xpath断言可以验证标记“ TargetEle”的所有值是否都以“ 123”开头吗?

Use starts-with function: 使用启动功能:

//TargetEle[starts-with(text(),'123')]

The starts-with checks whether the first string starts with the second string starts-with检查第一个字符串是否以第二个字符串开头

for negating (exists tags that don't start with 123) use not 否定(存在不以123开头的标签) 使用

//TargetEle[not(starts-with(text(),'123'))]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM