How would I locate the "tile" element in the HTML:
<div class="con-head">
<div class="up-at js-con-dates">
<span class="bold">Last date</span>
7:13 PM <br>
<span class="bold">Save</span>
7:12 PM
</div>
<p class="tile">Text: Kids </p>
<p class="desc js-desc" style="">Q&A </p>
</div>
I tried to locate it with the accessor:
div(:my_title) { div_element(:class => 'con-head').div_element(:class => 'tile') }
But it is not working and giving the error:
Watir::Exception::UnknownObjectException: unable to locate element, using {:class=>"tile", :tag_name=>"div"}
In the HTML, the element with class "tile" is actually a p
element:
<p class="tile">Text: Kids </p>
As a result, you need to locate it using the paragraph_element
method instead of the div_element
method:
div(:my_title) { div_element(:class => 'con-head').paragraph_element(:class => 'tile') }