I just answered my question using the supplied 1.5 answers and my knowledge of 
Watir 1.4.1 and some Ruby/OLE hacking skills I've acquired since using Watir.  
So I tried using Watir 1.5, and for what I needed that worked, but Watir 1.5 
crashed on my previous script, so it wasn't really a viable solution in the 
long run.  I didn't expect it not to crash though since it's still in 
development.  So I decided to see if I could do some patch work.  I diffed the 
watir.rb file visually for 1.5 with the one for 1.4.1 and found that 1.5 simply 
wraps more native OLE object properties for the element(s) in question (mine 
was Image or <img>).  Then I noticed that in 1.4.1 sometimes element 
attributes were gotten using @o.invoke("propertyName"), but there wasn't one 
for className or class_name.  So I pulled out irb, typed in some lines to get 
my browser and Watir 1.4 going (I had uninstalled Watir 1.5 at this point) and 
played with the following idea:

className or class_name must by an attribute that I can get via 
getOLEObject.invoke.  Here's what I came up with:

ie.images.each {
  |img| tempImage = img

  x = tempImage.getOLEObject
  if x.invoke("className") == "btn_viewResults"
    # Click on the image associated with the class name "btn_viewResults"
    tempImage.click
  end # End: if x.invoke("className") == "btn_viewResults"
}

Thanks for all of your help.  I'm glad I can hack it!
;) Nathan
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5661&messageID=16004#16004
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to