[Webtest] Canoo v1.6 build 544 (httpunit 1.6) Javascript Support?

Paul King webtest@lists.canoo.com
Tue, 14 Dec 2004 23:30:37 +1000


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.