Forum: Ruby IE Automation/Recorder - Watir/Wet

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
71322243ccefd73fe656d539f7e2910f?d=identicon&s=25 unknown (Guest)
on 2006-01-24 22:14
(Received via mailing list)
Hi,
I am trying to write a Record and Playback utility for Watir and WET,
using Ruby and the OLE provision it provides.

My detailed knowledge about IE and DOM is limited though, I am using
the the code below to capture HTML events by extending the sample code
at the end of this email.

ev = WIN32OLE_EVENT.new(ie, 'HTMLElementEvents2')
ev.on_event {|*args| html_event_handler(*args)}

I am able to detect clicks on components , focus in /out etc. however I
am unable to successfully, detect "onchange".

I am particularly interested in capturing this change so that i can
determine when the user entered data in fields, comboboxes, text areas
etc.

Any takers ?
Thanks and Regards,
Asif



Sample code you will find relevant

$urls = []
def navigate(url)
  $urls << url
end

def stop_msg_loop
  puts "IE has exited..."
  throw :done
end

def default_handler(event, *args)
  case event
  when "BeforeNavigate"
    puts "Now Navigating to #{args[0]}..."
  end
end

ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = TRUE
ie.gohome
ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')

ev.on_event {|*args| default_handler(*args)}
ev.on_event("NavigateComplete") {|url| navigate(url)}
ev.on_event("Quit") {|*args| stop_msg_loop}

catch(:done) {
  loop {
    WIN32OLE_EVENT.message_loop
  }
}


puts "You Navigated to the following URLs: "
$urls.each_with_index do |url, i|
  puts "(#{i+1}) #{url}"
end
Ec28a928f35c62e6822b98456659ec14?d=identicon&s=25 Serge Kolgan (ru551an)
on 2006-02-16 17:48
unknown wrote:

> I am able to detect clicks on components , focus in /out etc. however I
> am unable to successfully, detect "onchange".
>
> I am particularly interested in capturing this change so that i can
> determine when the user entered data in fields, comboboxes, text areas
> etc.

I'd be interested to see the solution to this question, too.
This topic is locked and can not be replied to.