I have to get the closest ancestor of WebElement with some attribute.
For example:
& lt; Div & gt; & Lt; I value1 = "hello" & gt; & Lt; One value1 = "bye" & gt; & Lt; Div id = "2" & gt; Hello & lt; / Div & gt; & Lt; / A & gt; & Lt; / I & gt; & Lt; / Div & gt; I have WebElment in Jave which is div (id = "2") / P>
How can I get the closest parents with the value1 attribute?
In this case, with the element a value1 = "bye"
I try the next: divElement.findElement (By.xpath ("/ ancestors-or-self :: * [Value1]");) but it does not work.
Try a related XPath expression, i.e. ./ not / :
divElement.findElement (By.xpath ("./product-or-self :: * [[value1] [1]") );
Comments
Post a Comment