cancel
Showing results for 
Search instead for 
Did you mean: 

xpath assertion

Highlighted
Frequent Contributor

xpath assertion

Hi,

I have data in a response as:

'Artist Name' and another element in same response as 'ArtistName'

I want to extract 'Artist Name' and verify that it matches with 'ArtistName'
I know that I need to split and then join 'Artist Name' element. I tried writing the logic in Xpath Assertion..but it complained saying split is not found....Can someone tell me how to achieve this?
3 REPLIES 3
Highlighted

Re: xpath assertion

Hi Usha,

can you show the actual xml response and your xpath expression?

regards!

/Ole
eviware.com


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Frequent Contributor

Re: xpath assertion

Hi Ole,

My Response is :

                   
                        2765
                       
                       
                        Soulja Boy ------ Artist Name
                        Gucci Bandana 
                        /swrv/Images/GameImages/BB_SouljaBoy_02.png ---ArtistName
                        1103
                        WebUser
                   

As you see above, in the Name element I have value 'Soulja Boy' and in URL i have 'SouljaBoy'

I want to check Name 'Soulja Boy' is part of URL.

My Xpath expression:

declare namespace aetgt='http://musicchoice.com/services/games';
matches( //aetgt:GetGameMetaDataResponse[1]/aetgt:GetGameMetaDataResult[1]/aetgt:Contestants[1]/aetgt:Contestant[1]/aetgt:MetaData[1]/aetgt:EntrantInfo[1]/aetgt:Url[1]/text(), 'Soulja' )
This works.

I have 100 nodes of such type. So I want to get Name and split it and then join it and then assert that against URL.

I actually want to use groovy scipt for this...i dont know groovy..
Highlighted

Re: xpath assertion

Try using the xpath replace function to replace space with an empty string, than check if the resulting string is in the URL.

/Nenad
http://eviware.com


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
Top Kudoed Authors