read text from div that only has multiple class matches with Watir
I am trying to read the text of a div that nested inside another. Each of
these div's only have class as an identifier. I am tried to use the index
of the div's but is not working at all. My html looks like this
<div class="zoneA">
<div class="zone2A">
<div class="zone3A">
<div class="zone3ALeft">
Text1
</div
<div class="zone3ARight">
Text2
</div>
</div
</div>
</div>
<div class="zoneA">
<div class="zone2A">
<div class="zone3A">
<div class="zone3ALeft">
Text3
</div
<div class="zone3ARight">
Text4
</div>
</div
</div>
</div>
I want to read the text from the div's with class="zone3ARight".
I'm just not 100% sure on the way to do with with so many class's with the
same name. I'm trying something like this.
puts browser.div(:class, "zone3ARight", :index, 0).text
puts browser.div(:class, "zone3ARight", :index, 1).text
But get argumentError: expected Hash or (:how, "what")
No comments:
Post a Comment