I have following html like:
<form name="form1">
<input name="a" ...>
<input name="b" ...>
...
<div><span><select name="c">...</select></span></div>
</form>
I would like to find out all elements within the form element. First I use findElement()
to get the form element form1
, then use form1.findElements(By.xpath(".//*[@name]"))
to get all its children having attribute name
. However, for the select
element, since it's grand-grand child of form1
, how can I get it as well?
Is there a way to find all elements containing attribute name
(not only child elements, but also child's child's child...) within form1
?
Thanks!