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
>