I am trying to access a div in a li array
<ul> <li class="views-row views-row-1 views-row-odd views-row-first"> <div class="news-item"> </li> <li class="views-row views-row-2 views-row-even"> <li class="views-row views-row-3 views-row-odd"> <div class="news-item"> <div class="image"> <div class="details with-image"> <h2> <p class="standfirst">The best two-seat </p> <div class="meta"> <div class="pub-date">26 April 2012</div> <div class="topic-bar clearfix"> <div class="topic car_review">review</div> </div> </div> </div> </div> </li>
I am trying to access the "div class =" topic car_review "> car overview" and get its text. The reason I specifically use this text is because, depending on what the text is, it introduces specific steps.
The code I'm using is
@topic = @browser.li(:class => /views-row-#{x}/).div(:class,'news-item').div(:class,'details').div(:class,'meta').div(:class,/topic /).text
the script worked fine and suddenly stopped working and just couldn't get a div (: class, 'news-item').
The error message I get is
unable to locate element, using {:class=>"news-item", :tag_name=>"div"} (Watir::Exception::UnknownObjectException)
I tried div (: class => / news- /), but still it just couldn't find this element
I'm really stuck !!!
source share