Today I tried to use Selenium to automatically test this:
http://www.irian.at/myfaces-sandbox/inputSuggestAjax.jsf

It's an autocompleting AJAX input field. (The implementation just suggests what you typed followed by numbers, so for "foo" it suggests "foo1", "foo2", "foo3", "foo4", etc.)

Immediately I ran into the problem that I couldn't trigger a keypress using Selenium. I therefore stole FJH's code from here:
http://jira.openqa.org/browse/SEL-143

This code seemed to work, but it forced the autocomplete control not to autocomplete, because at the end of every triggered event in selenium-browserbot.js, it ends the action by triggering a "blur" event on the control. PageBot.selectOption, .replaceText, and .clickElement all come with automatic blurs at the end; FJH just reproduced this in his .keypressElement, .keydownElement, .mouseoverElement, and .mousedownElement.

Unfortunately, the AJAX autocompleter has logic that says: "If I still have the focus once the AJAX request is done, then display a nifty auto-completion list... otherwise, the user must be doing something else, so forget about it." Since all of the PageBot triggered events blur immediately after action, the autocompleter never thinks it should autocomplete.

Commenting out the 'blur's seemed to do the trick, but I'm a little nervous about doing that. Are these 'blur' actions good for me for some reason? Does adding them fix a bug that I'm now re-exposing?

-Dan
_______________________________________________
Selenium-devel mailing list
Selenium-devel@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel

Reply via email to