Suppose I have this (simplified):
<form id="myform"> <input type="submit" value="proceed"/> </form>
Then I can select the XPath submit button //form[@id='myform']/input[@type='submit'] . Fine.
However, my templates can change, and I want to be flexible in the depth in which the submit button is located. It can be placed in a table, for example:
<form id="myform"> <table><tr><td> <input type="submit" value="proceed"/> </td></tr></table> </form>
I know that I can choose elements that are grandchildren, but I cannot choose grand grand grand ... any depth. For example:.
//form[@id='myform']/*/input[@type='submit'] selects only grand children, further depths.//form[@id='myform']/*/*/input[@type='submit'] selects only grand-grand-children, without further or lesser depths.//form[@id='myform']/**/input[@type='submit'] invalid.
So, how can I select this submit button correctly without using item identifiers?
xpath
gertvdijk Apr 15 '13 at 13:33 2013-04-15 13:33
source share