Selector for a web element with relative to its sibling element

Hi ,Consider the following case,

Case 1:
<html>

<div class='parent'>

<data>"Content X"</data>

<data>"result1"</data>

<data>"Content Y"</data>

<data>"result1"</data>

</div>

</html>

Is there any possibility to frame a selector to check the existence of the element(result1) that is
next to Content Y and not the one after Content X using nav tag or any other options.Since both
the elements have same aaname i’m facing issue in framing selectors.Also the following cases
are also possible even then i need to check only the existence of result1 that is next to Content Y

Case 2:
<html>

<div class='parent'>

<data>"Content X"</data>

<data>"result1"</data>

<data>"Content Y"</data>



</div>

</html>

Case 3:
<html>

<div class='parent'>

<data>"Content Y"</data>

<data>"result1"</data>

<data>"Content X"</data>

<data>"result1"</data>

</div>

</html>
1 Like

Any solution for this?

This is an old thread, but just in case someone else needs this type of solution, you should be able to find your Content Y, and use the <nav next='1' /> additional selector element to achieve this (pull the right sibling).

Best,

Bruno Costa.