selenium - How to ensure div tag is present in between 2 other tags -


please find attached screenshot:

enter image description here

in attached screenshot need ensure selected div tag present after <section class="hp_news">.

what logic need use this?

use below code verify weather <div> tag after specific section

list<webelement> ads = driver.findelements(by.xpath("//section[@class='hp_news']/following::div[@class='adunit']")); if(ads.size()>0) {     system.out.println("add available");  }  else  {         system.out.println("not available");   } 

use following-sibling method of xpath locate <div> based on <section> tag having class = "hp_news"


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -