tags:

views:

57

answers:

1

I am trying to locate the first <th> element under a <table> element. The table element is tagged with a particular id, and is locatable when I only look as far as that tag.

But when I try to go a little further down and search using the XPath below, it returns a null element. The '/th[0]' is to say: return the first <th> element, under the element that is tagged with the particular id.

In the example, the id value is populated prior to the search:

"//*[@id='{0}']/th[0]"
+4  A: 

XPath indexes are 1-based. Try: //*[@id='{0}']/th[1]

This trips me up all the time as well; too much time spent with 0-based indexing in C, C++, etc.

Shog9
damn. that was a setup 10 years in the making. they got me. thanks
Chris