Forum Discussion
KarelHusa
3 years agoSuper Contributor
relying on a fixed position (using indexes in your XPath) in XML may be fragile. Next time you may get additional elements, and your XPath will no longer work.
That's where a query helps.
What kind of response do you get if you test the following expressions:
//ns2:BuyTotal/ns2:Amount[text() = 742.50]
count(//ns2:BuyTotal/ns2:Amount[text() = 742.50]) > 0
thatsthat
3 years agoContributor
The thing is .. this does not point to the test step I need to collect the information from .. so I believe I am not constructing the message correctly ..
count(//ns2:BuyTotal/ns2:Amount[text() = 742.50]) > 0So i get:
The XPath Match assertion failed for the following path: [declare namespace ns2='http://www.xyz.com/gateway/fire/schema'; declare namespace env='http://www.w3.org/2003/05/soap-envelope'; //ns2:BuyTotal/ns2:Amount[text() = 742.50]]. Expected value: [394.50]; Actual value: [].