[Webtest] JS error on Google page: type(...) vs setAttributeValue(...) for setInputField

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Wed, 10 Sep 2008 15:08:01 +0200


Hi all,

some users have reported recently that the WebTest examples using Google
didn't work anymore.
After some investigation, I've found that there is really a reproducible
JS error on Google's start page and that WebTest was right!  I've
blogged about this if you're interested by the details:
http://mguillem.wordpress.com/2008/09/10/why-google-should-better-use-htmlunit/

The cause of the JS error is that WebTest currently uses
setValueAttribute(...) and not type(...) to set a value on a text field.
 The consequence is that on Google's page the keypress handlers are not
called as they would when the text is typed. On the other side, setting
the value directly is nearer to pasting the value (with right mouse
click for instance) which is valuable as well.

Now the question: what should be done in <setInputField.../>?
- use type(...) to simulate typed text (and therefore trigger JS handlers)
- keep setValueAttribute(...) as it is today (allows to better simulate
pasted text)
- allow both? But which one should be the default and how should the
other option be selected?

I wait for your comments.

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com