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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -