I'm using Watir WebDriver with Firefox.

Here are two asserts for the same element. The first works, but not the 
second:

assert_match(/Please add user to GMT/, @browser.small(:class, "error").text)
assert_match(/Please add user to GMT/, @browser.div(:class, "eight mobile-three 
columns").small(:class, "error").text)

I need the second assert to work, because there are 8 error messages on the 
page, which are presented if the user does not populate 8 mandatory fields. 
All 8 errors have the identical HTML. So, I need to be able to step down 
from the parent.

Here is the HTML:

<div class="eight mobile-three columns">
  <a id="btnAddUserToGMT" class="success radius button expand error" 
onclick="AddUserToGMT();" data-reveal-id="addToGMT" href="#"> … </a>
  <small class="error" style="margin-top:0px;">

    Please add user to GMT

  </small>
</div>

Here is the error message:

Watir::Exception::UnknownObjectException: unable to locate element, using 
{:class=>"error", :tag_name=>"small"}
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/elements/element.rb:490:in
 `assert_exists'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/elements/element.rb:85:in
 `text'
C:/Documents and Settings/Asserts_01.rb:22:in `testBasic'

Note that the complaint for the second assert is:

unable to locate element, using {:class=>"error", :tag_name=>"small"}

But that same using was OK for the first assert.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to