Have
you tried "ie.set_fast_speed()"?
-=michael=-
--
Michael Kelly
Sr. Software Engineer
Eleven Wireless Inc. - The Possibilities are
Wireless
http://www.elevenwireless.com
-----Original Message-----I started using Watir to automate a small portion of my projects tests. It has been wonderfully helpful, and I'd like to thank the Watir team for making it available.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jared Nuzzolillo
Sent: Friday, August 12, 2005 9:49 AM
To: [email protected]
Subject: [Wtr-general] WATIR is slow ???
I do have, however have a problem. When I execute my program, it takes a REALLY long time to run. It is setting about 400 fields, and it was painful to watch it move slowly from field to field. I already tried setting it "fast mode" and "background" mode and it sped up significantly, but it was still slow.
Fortunately, I generated the WATIR script from the HTML form using JScript. As a result of generating it, I used :name to access all of the fields I had to set. Unfortunately, I had hand-edited my generated script to put 'realistic' values into all of the fields, so it would have been a PITA to write new methods to set all of the fields. The fix I used was to overwrite the WATIR text_box, select_list, radio and checkbox methods to access the DOM directly instead of 'typing' the values into the fields. This changed the execution time from about 3.5 minutes to about 15 seconds. Thanks to the power of Ruby, I didn't have to edit my code generator and regen.
Was there an easier path? Some flag of which I'm unaware?
Thanks so much,
Jared Nuzzolillo
The (admittedly hackish and cruddy) code I used to modify it:
class IE
def text_field(toss, name)
fld = self.ie.document.forms.namedItem("frmApply").elements.namedItem(name)
class << fld
def set(val)
self.value = val
end
end
fld
end
def checkbox(toss,name)
fld = self.ie.document.forms.namedItem("frmApply").elements.namedItem(name)
class << fld
def set
self.checked = true
end
#haven't tested this one yet
def clear
self.checked = false
end
end
fld
end
def radio(toss,name)
fld = self.ie.document.forms.namedItem("frmApply").elements.namedItem(name)["0"]
class << fld
def set
self.checked = true
end
#haven't tested this one yet
def clear
self.checked = false
end
end
fld
end
def select_list(toss,name)
fld = self.ie.document.forms.namedItem("frmApply").elements.namedItem(name)
class << fld
def select(txt)
self.options.each{|i| i.selected = true if i.text == txt }
end
end
fld
end
end
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
