-1

I am using karate framework for my api testing. It seems the retry logic not working as expected for xpath conditions. I want to retry the same request until some response value to met expected value. Find the sample and error below

code Code

And the error is

retry condition evaluation failed: javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: A location path was expected, but the following token was encountered: =

1 Answers1

0

Yes XPath is not supported, you need to come up with a JS expression to do your logic. Please read this carefully: https://stackoverflow.com/a/55823180/143475

Hint - you can do XPath operations in JS like this:

* def response = <root><result>5</result></root>
* def fun = function(r){ return karate.xmlPath(r, '//result') == 5 }
* fun(response)
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248