Amol
> If it's all too ugly to bear lookin at it, wrap it in a Ruby method or
> class.  For example, you might add a method visible? to Element. In that
> method, you could ascend the DOM tree, checking first the node and then each
> parentNode in turn to see if it is visible (climbing the tree in the reverse
> the cascade of inheritance).

For anyone whose interested, here's what I was suggesting:

   class Element
      def visible?
         elm = @o;
         display = true
         while(elm && elm.tagName != 'BODY')
            style = elm.invoke("style");
            if style.invoke("display") == 'none' ||
style.invoke("visibility") == 'hidden'
               display = false
               break
            end
            elm = elm.parentElement
         end
         display
      end
   end

Now all you need to do is something like this:

$ie.text_field(:name, "customer.name").visible?

If it's generally useful, maybe Bret et.al. might consider including
it. For now, paste it into your test script or include it from a file.

John

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

Reply via email to