How to speed up text field data entry

32 views
Skip to first unread message

Robert

unread,
Aug 8, 2008, 7:18:22 PM8/8/08
to Watir General
I'm using both Watir and FireWatir. I've developed a script that
works well with both APIs. However, it seems that when the script is
executed in FireWatir, the speed with which data is entered into text
fields is *really* slow. Anybody out there know how I can speed up
data entry into text fields for FireWatir. I've tried using

text_field.value='my value'

instead of

text_field.set 'my value'

However, it appears that using .value= results in the script missing
some of the web app's triggering events. Any help on this would be
greatly appreciated.

Regards,
Robert

Robert

unread,
Aug 14, 2008, 3:58:30 PM8/14/08
to Watir General
Ok...so, I'm replying to my own post...weird I know, but I was hoping
someone out there may have encountered this issue with Firewatir
before. We are trying to sell Watir/Firewatir to our management team.
It would certainly make pitching Watir/Firewatir that much easier if I
could overcome the speed issue with Firewatir.

Paul Rogers

unread,
Aug 14, 2008, 4:29:41 PM8/14/08
to watir-...@googlegroups.com
I meant to reply to your earlier post, but, well I forgot :-(

Lots of people have encountered this. In my app I know where the
javascript vsalidations are, so I just use .value=( 'blah') and then
fire the appropriate events manually

Paul

bmorzos

unread,
Aug 14, 2008, 4:40:33 PM8/14/08
to Watir General
I did the same as Paul I think. I created a method that I use
everywhere instead of .set.
It may or may not have all of the events you need. It appears to run
about as fast as .value, but
I have never timed it.

I think the set method fires events after each character entered if I
remember correctly.

def self.populate(field, text = nil, check_field_value = true)
if (text != nil)
puts('populate() - Field: ' + field.name.to_s)
puts("populate() - Setting field to value: " + text)
end
# field.scrollIntoView #method name not available for Watir -
Firewatir only
field.focus
# field.select() #method name not available for Watir - Firewatir
only
field.fire_event("onSelect")
# field.fire_event("onValid")
field.value = ""
field.fireEvent("onKeyDown")
field.fireEvent("onKeyPress")

if (text != nil)
field.value = text
if (field.value != text && check_field_value == true)
raise ArgumentError, "After setting field value, value does
not match: " + text + ":::: field.value = " + field.value, caller
end
else
puts('Field text was passed as nil')
end

field.fireEvent("onfocus")
field.fireEvent("onKeyUp")
field.fireEvent("onChange")
field.fireEvent("onBlur")
end

Brian Morzos

On Aug 14, 2:29 pm, "Paul Rogers" <paul.rog...@shaw.ca> wrote:
> I meant to reply to your earlier post, but, well I forgot :-(
>
> Lots of people have encountered this. In my app I know where the
> javascript vsalidations are, so I just use .value=( 'blah') and then
> fire the appropriate events manually
>
> Paul
>
Reply all
Reply to author
Forward
0 new messages