Skip to content Skip to sidebar Skip to footer

HTML XPath - How To Select A Node Based On Children's Value Per Index?

Given the following example HTML code:
Value 1

Solution 1:

Simple

//tr[normalize-space(td[1]/div) = 'Value 1' and normalize-space(td[2]/div) = 'Value A']

Demo - http://www.xpathtester.com/obj/e3d5b9bf-79d5-4e81-a336-daba38d430fe


Solution 2:

Your expression works for me, although I would write it like this:

//table/tr[td[1]/div = 'Value 1' and td[2]/div = 'Value A']

Post a Comment for "HTML XPath - How To Select A Node Based On Children's Value Per Index?"