[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

attachRecording method in WatirMaker script

Matthew Hailstone

9/27/2006 5:27:00 PM

I modified the watirmaker script
http://www.hanselman.com/blog/content/binary/WatirMa...
to contain the following method right under startRecording

def attachRecording

# initialize IE
require 'watir'
@watirie = Watir::IE.attach(:title,/#{$windowName}/)
@ie = @watirie.getIE()
@ie.visible = TRUE

browserEvents = WIN32OLE_EVENT.new( @ie, 'DWebBrowserEvents2' )
browserEvents.on_event { |*args| browserEventHandler( *args ) }

# print script header
puts "##//////////////////////////////////////////////////////////////////////////////////////////////////"
puts "##"
puts "## Watir script recorded by WatirMaker."
puts "##"
puts "##//////////////////////////////////////////////////////////////////////////////////////////////////"
puts ""
puts "#requires"
puts "require 'watir'"
puts ""
puts "#includes"
puts "include Watir"
puts ""
puts "ie = IE.attach(:title,/#{$windowName}/}"
# puts "ie.set_fast_speed()" this doesn't seem to work so well
with multiple frames
puts ""

# capture events
catch( :done ) {
loop {
WIN32OLE_EVENT.message_loop
}
}

# IE takes a moment to close.
# Making it invisible in the interim produces a slightly nicer
user experience.
@ie.visible = FALSE
end

And at the end of the file I inserted:

wm = WatirMaker.new
wm.startRecording if !$windowName
wm.attachRecording if $windowName

I get the following error:

watirmaker.rb:168: [BUG] Segmentation fault
ruby 1.8.5 (2006-08-25) [i386-mswin32]

This is found in the attachRecording method at the following:

WIN32OLE_EVENT.message_loop

I start the command like this:

ruby -s watirmaker.rb -windowName="MyTitle"

Any thoughts?

Matthew

1 Answer

BoJo

10/12/2010 5:53:00 PM

0

On Oct 12, 1:28 pm, TBK <rrezen...@gmail.com> wrote:
> > F5 worked Thanks, why out of no wear do I have to hit F5. I am not
> > much of a computer person.
>
> Simply put, the internet doesn't always do what it is supposed to and
> there a number of places where thigs can go wrong.
>
> F5 (also Shift-F5 for really stubborn issues) is simply a refresh
> command that tells your browser "Hey, try that again, I can't see what
> I want here."
>
> Shift-F5 is a little deeper and tells your computer "Hey, try that
> again, I can't see what I want here. BUT when you do it, contact the
> original server to make sure I'm getting the latest information it has
> available (rather than something cached on your side)
>
> Hope that helps,
> ~Ron R
> TBK=The Biggest Kid
> "Route-rat extraordinaire!"

Control + F5 does that, not shift unless it varies by computer.