Ask a Question

[SOLVED]assertion for null node

Usha_Kodali
Frequent Contributor

[SOLVED]assertion for null node

Hi,

I use getDomNodes to get multiple nodes.
before extracting values i want to make sure the node is not null.
def videodescr = holder.getDomNodes( " //aetgt:GetVideoMetaDataResponse/aetgt:GetVideoMetaDataResult/aetgt:VideoMetadata/aetgt:Video/@Title" )
assert videodescr != null.

The above assertion doesnt work.

What is the step or function i can use to check that nodes are not null.
3 REPLIES 3
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi Usha,

If you mean to check that there are Title attributes then please try

assert videodesc.length > 0

Does that work?

regards!

/Ole
eviware.com

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

yep this worked for me!
SmartBear_Suppo
SmartBear Alumni (Retired)

great!

/Ole

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: