Walking the tree is encapsulated inside the code, it's not advanced. Pull
the code from the page:
http://wiki.openqa.org/pages/viewpage.action?pageId=1119
Put it somewhere in your ruby load path, current directory works.

Save the file to watir_ext.rb in your test directory, then use the following
to try it out.

require 'watir'
require 'watir_ext'
include Watir

ie = IE.new
ie.goto("www.someplace.com")
button = ie.button(:id, 'somebutton')
if button.visible?
 button.click
else
 ie.close
end

-Charley

On 12/21/06, Charley Baker <[EMAIL PROTECTED]> wrote:

There's a user contribution on the Wiki:
http://wiki.openqa.org/pages/viewpage.action?pageId=1119    that extends
element to walk the DOM tree and check for disabled or non-visible elements.



-Charley

On 12/21/06, Paul Rogers <[EMAIL PROTECTED]> wrote:
>
>  didnt some one post a is_visible?  ( or visible?)  method to the list?
> I think it walked up the dom tree looking to see if parent elements were
> visible, as the approach here wont work if the element that encloses the
> span ( if there is one ) is also hidden.
>
> Paul
>
> ----- Original Message -----
>  *From:* Ċ½eljko Filipin <[EMAIL PROTECTED]>
> *To:* [email protected]
> *Sent:* Thursday, December 21, 2006 2:45 AM
> *Subject:* Re: [Wtr-general] How to verify if SPAN is visible
>
> For
>
> <span style="color: Red; visibility: visible;"
> id="MainLogin_PasswordRequired">*</span>
>
> you can use
>
> irb(main):015:0> ie.span(:id, "MainLogin_Password").html
> => "<SPAN id=MainLogin_PasswordRequired title=\"Password is required.\"
> style=\"VISIBILITY: visible; COLOR: red\">*</SPAN>"
> irb(main):016:0> ie.span(:id, "MainLogin_Password").html =~ /visible/
> => 85
> irb(main):017:0> ie.span(:id, "MainLogin_Password").html =~ /hidden/
> => nil
>
> It is similar when span is hidden.
>
> Is this useful for you? Let me know if it is to cryptic, I will add more
> detail.
> --
> Zeljko Filipin
> zeljkofilipin.com
>
> ------------------------------
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to