cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath Match by ChildNode

Highlighted
Occasional Visitor

Xpath Match by ChildNode

Hi, I'm trying to dev a test to assert if API response returns the same child nodes that I'm looking for. Since the info that I'm looking for doesn't return as value but child nodes, I need to match them with element names.

 

 

<Root> <Child1Parameters>...</Child1Parameters> <Child2Parameters>...</Child2Parameters> <Child3Parameters>...</Child3Parameters> <Child4Parameters>...</Child4Parameters> </Root>

So as in the example, I want to check if Root element has "Child1Parameters", "Child2Parameters", "Child3Parameters" and "Child4Parameters" nodes.

 

Do you know how can I do this?

 
 
 
 
3 REPLIES 3
Highlighted
Community Hero

Re: Xpath Match by ChildNode

Is it a SOAP request? If so, try using schema validation assertion.


Regards,
Rao.
Highlighted
Community Hero

Re: Xpath Match by ChildNode

am I misunderstanding?  the way I read this it sounds like you are asking to just assert the presence of the XML instance's elements or do you mean something different?

 

if you just need to assert the presence of specific tags within the response, wouldn't an existence check be what you need?

 

ta,

 

rich

 

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Manager

Re: Xpath Match by ChildNode

Hi @hincal, was the advice from the Community helpful? 

 

nmrao, richie – thank you! Smiley Happy


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors