I am having some difficulty automating the autocomplete functionality
of a textbox. The way I've done it before is to use type_keys and
focus to trigger the behavior. I can set the text in the textbox
without problem. If I try to set focus it appears nothing happens.
However, I don't get any errors and I am able to use set on the same
textbox without problem after the type_keys code, so it is getting set
*somehow*. I looked at the source code for TextField.set (
http://wtr.rubyforge.org/rdoc/1.6.5/classes/Watir/TextField.html#M000606
) and tried to reproduce the fire_event calls, but no luck. My
problem looks very similar to the bug filed for IE7 (
http://jira.openqa.org/browse/WTR-197 ) but I see no evidence focus is
going to the address bar and I am not using IE7. I can use
show_active if I use IE as the browser and it seems to show that the
text field is in fact the active element, but I can't send keys to
it. In any event, I need to be able to run the script from both
Firefox and IE with a minimum of specialized code.
thanks in advance,
Sabrina
Environment: Windows 2003 Server SP2
Browsers: Firefox3.6.3, IE 8.0.6001
Watir 1.6.5, Ruby 1.8.6
Running tests in NetBeans 6.8
using the browser instance @b,
@b.text_field(:id, "fieldQuery").set "test"
@b.text_field(:id, "fieldQuery").focus #tried a flash
statement after this line, and nothing flashed
@b.text_field(:id, "fieldQuery").select #this *does*
appear to select the "test" text in the text field
@b.text_field(:id, "fieldQuery").fire_event("onSelect")
@b.text_field(:id, "fieldQuery").fire_event("onKeyPress")
# @b.text_field(:id, "fieldQuery").type_keys("r")
#nothing happens (old attempt)
@b.text_field(:id, "fieldQuery").doKeyPress("r")
#nothing happens
@b.text_field(:id, "fieldQuery").fire_event("onchange")
@b.text_field(:id, "fieldQuery").set "halp"
#this works correctly
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
You received this message because you are subscribed to
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe, reply using "remove me" as the subject.