[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IE Automation/Recorder - Watir/Wet

asif.kazi

1/24/2006 9:11:00 PM

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

1 Answer

Serge Kolgan

2/16/2006 4:49:00 PM

0

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.

--
Posted via http://www.ruby-....