[Webtest] Canoo v1.6 build 544 (httpunit 1.6) Javascript Support?
Paul King
webtest@lists.canoo.com
Wed, 15 Dec 2004 01:07:14 +1000
Marc Guillemot wrote:
> Concerning Date(), you're right: rhino complies to ECMA standard like
> Mozilla/Firefox but not IE. But the DOM objects are the job of htmlunit
> not of rhino. There are probably more IE specific objects/methods that
> are configured to work with rhino therefore I would rather say that the
> javascript support of htmlunit is closer to IE than to Mozilla/Firefox.
>
> Marc.
Thanks for the feedback.
My initial impression of HtmlUnit was that it supported most of the
standard DOM objects (which Mozilla/Firefox sticks to closely) and some
of the IE special ones. Just checking against my JS reference and this
is sort of but not exactly the case. There are about 20 supported ECMA
objects (which work for both IE and Moz/Fx) and about 14 unsupported
ECMA objects (missing from IE and Moz/Fx) - I think Area, Checkbox,
FileUpload, Frame, Hidden, Layer, Link, MimeType, Password, Plugin,
Radio, Reset, Submit and Text. There also appears to be about 10
unsupported JScript objects (missing from just IE but mostly ones you
wouldn't normally use in Internet sites).
Given that, I am not sure I would want to make a call on which is closer
based on DOM functionality. You've been playing alot more with HtmlUnit
than me so you might be braver than me in making that call! :-)
Getting back to the original query which I was responding to, there
certainly is a jsSet_action() method on the Form object, so that part of
the JavaScript should execute - what I am not sure about is what events
occur after that. There is a jsFunction_submit() method on Form as well,
so adding form.submit() may force the JS to behave as intended.
I am not sure what the standard says should occur in the particular
example Richard presented. Is simply returning good enough or is an
explicit return true required? Trying it out in Moz/Fx could prove
useful. It might be fussier about how it does things than IE in areas
which mimic Rhino's behaviour.
There are plenty of holes in the JS implementation of Rhino/HtmlUnit but
trying out an example in both IE and Moz/Fx is probably a good way to
eliminate any browser specific assumptions about the intended behaviour.
Cheers, Paul.
> Paul King wrote:
>
>> Marc Guillemot wrote:
>>
>>> Paul King wrote:
>>>
>>>> ...
>>>> The JavaScript engine that webtest uses is closer to Mozilla/Firefox
>>>> than IE. Does your page work in all browsers? Perhaps an explicit
>>>> "return true" or "form.submit()" in your JavaScript might help.
>>>
>>>
>>>
>>>
>>> what do you mean with closer to Mozilla/Firefox than IE?
>>
>>
>>
>> HtmlUnit and HttpUnit both use the Rhino JS engine from Mozilla. Rhino
>> has numerous differences compared with IE's JScript support. Most of
>> the differences are at the DOM level and HtmlUnit does a better job of
>> supporting those differences - at the moment it supplies a better set
>> of browser specific host objects than HttpUnit but still not all of
>> the "special" things that are in IE. There are also language
>> differences in addition to DOM differences, for example:
>>
>> Doing 'alert("Year is " + new Date().getYear())' in some JavaScript in
>> webtest (HttpUnit or HtmlUnit versions) or Firefox or Mozilla yields
>> "Year is 104". This is as per the ECMA script which by the way is not
>> Y2K compliant - hence the strange result. IE produces "Year is 2004" -
>> what you expect but not compliant. BTW: using getFullYear() is the
>> ECMA function which is Y2K compliant - and luckily is supported by IE
>> too!
>>
>> For more details of the above and other examples, see:
>>
>> http://nexgenmedia.net/evang/iemozguide/#javascript_differences
>>
>> Other parts of the above page also detail some of the DOM and event
>> differences between the browsers.
>>
>> Cheers,
>>
>> Paul.