JMeter - 使用 Xpath 验证多个元素
JMeter - validate multiple elements using Xpath
我得到一个 XML 喜欢:
...
<TargetEle>12356 <TargerEle>
...
<TargetEle>123dagih <TargerEle>
...
Xpath断言是否可以验证标签"TargetEle"的所有值是否都以“123”开头?
使用starts-with函数:
//TargetEle[starts-with(text(),'123')]
The starts-with checks whether the first string starts with the second string
对于否定(存在不以 123 开头的标签)使用 not
//TargetEle[not(starts-with(text(),'123'))]
我得到一个 XML 喜欢:
...
<TargetEle>12356 <TargerEle>
...
<TargetEle>123dagih <TargerEle>
...
Xpath断言是否可以验证标签"TargetEle"的所有值是否都以“123”开头?
使用starts-with函数:
//TargetEle[starts-with(text(),'123')]
The starts-with checks whether the first string starts with the second string
对于否定(存在不以 123 开头的标签)使用 not
//TargetEle[not(starts-with(text(),'123'))]