Xpath ancestor finding div -


i got html looking

<div id="depositmodalxx" class="modal hide">     <div class="modal-header">         <h3> deposit </h3>     </div>     <div class="modal-body">         bla bla bla     </div> </div> 

and in file there more 1 modal, need find text. tried this

ancestor::div[.//div/h3/text() = 'deposit'] 

but returns more div searching. ideas how div want?

this should work

//div[div/h3 = ' deposit '] 

if want check div has modal class can do

//div[contains(@class, 'modal')][div/h3 = ' deposit '] 

i don't quite why don't search using @id. id should unique in html anyways, should able select element , realiably.


Comments