Karate 在空手道框架中,无法通过解析在xml响应中获取值

Karate 在空手道框架中,无法通过解析在xml响应中获取值,karate,Karate,将空手道作为我的POC中的工具, 这是我的要求- 我用下面的代码练空手道 Given url 'http://www.mocky.io/v2/5d7267732f00004a007d4cb1' When method GET Then status 200 Then print response And match response == expectedoutput * def val = $expectedoutput/Group/Elements/Group/Elements/Grou

将空手道作为我的POC中的工具, 这是我的要求-

我用下面的代码练空手道

Given url 'http://www.mocky.io/v2/5d7267732f00004a007d4cb1'
When method GET
Then status 200 
Then print response
And match response == expectedoutput

* def val = $expectedoutput/Group/Elements/Group/Elements/Group[0]/Elements/Set
And print 'value is' , val
它抛出了一个错误-

com.intuit.karate.exception.karateeexception:userxmlDetails.feature:12 -xpath不存在:/Group/Elements/Group/Elements/Group[0]/Elements/Set on expectedoutput 在✽.* def val= $expectedoutput/Group/Elements/Group/Elements/Group[0]/Elements/Set (userxmlDetails.feature:12)


我还尝试了
expectedoutput/Group/Elements/Group/Elements/Group[0]/Elements/Set

如果这个问题看起来不成熟,很抱歉,但我解决了它。我们需要提供以下信息

  • def val=$expectedoutput/Group/Elements/Group/Elements/Group[1]/Elements/Set
组[0]将不被接受,因为此处的索引从1开始