html - Get the first following div sibling -


i trying write xpath uniquely identify 1 element document looks this

<aaa>    <div>   </div>    <div>   </div>    <div>       <div id='d'>yes</div>    </div>    <div>   </div>  ---> want select based on mentioned sibling condition    <div>   </div>  </aaa> 

i want select div element following sibling of div element, containing child div element[containing yes]. tried doing failed:

//following-sibling::div[@id='d']/div[contains(. , 'yes')] 

please help.

the xpath select following-sibling div elements of div containing yes be:

//div[contains(., 'yes')]/following-sibling::div 

in current xml, third div , it's child div both contain yes value. child doesn't have following-sibling here. so, last 2 div elements(which following-sibling third div in xml) selected.

edit

//div[div[contains(., 'yes')]]/following-sibling::div[1] 

this select first following-sibling div element of div child div(with value yes).


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -