selenium - How to ensure div tag is present in between 2 other tags -
please find attached screenshot:
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
Post a Comment