Ask a Question

I am very new to this and am having lots of issues with X Path Matches - can anyone help - please

BraimO
Occasional Visitor

I am very new to this and am having lots of issues with X Path Matches - can anyone help - please

Hello, 

 

I have just recently installed SOAP UI to try and up skill at home after been made redundant from my last role.

 

I have managed to get a few projects started and am getting to understand most (if not in great detail yet) teh assertions that can be used. However one that I am having some issues with is the X Path Match.

 

I have managed to get a very basic check to pass, however if I am understanding the concept correctly (and I may not be doing) I think it should identify content based on positions in the response. 

 

What I cannot understand is how do I make the position unique. 

 

If I am part understanding this correctly then I can see why it might be "tighter" than a "Contains Assertion" as it will look for specific instances as opposed to a blanket check... however I am struggling to see how it does this.

 

If anyone can help, or share a working example that would be very, very appreciated. 

 

I have also included two screen clips of my attempts, one that woulds and one that fails. 

 

I do not understand why the one that fails does indeed fail, and I do not think the one that works is performing a proper check, or not what I think it should be checking anyway. 

 

Best Regards (and thanks in advance)

Neil

 

1 REPLY 1
PaulMS
Super Contributor

Hi Neil,

 

There is more than one match in the response for //m:tCardInfo (an error message is displayed when clicking the Select from current button), so if you want to select the first occurrence then the XPath Expression could be

//m:AllCardsResult/m:tCardInfo[1]/m:sGameTeam2

 

If you want to select a specific game date then the XPath Expression could be

//m:AllCardsResult/m:tCardInfo[dGame='2016-06-10'][1]/m:sGameTeam2

 

Some other examples

https://www.w3schools.com/xml/xpath_examples.asp

 

 

cancel
Showing results for 
Search instead for 
Did you mean: