[Webtest] [dev] How to specify the browser to simulate for js support

Marc Guillemot webtest@lists.canoo.com
Wed, 10 Nov 2004 16:21:03 +0100


Hi,

htmlunit has the nice feature to allow to test some browser specific javascript code. This means for instance that 
expression like "document.all" will not evaluate the same depending on the browser that htmlunit simulates.

As we didn't have such a notion in previous version of webtest, I've introduced the following behavior based on the 
user-agent header set with <header> tag of <config>:
- if it contains the string "Netscape", simulate - as of htmlunit - Netscape 6.2.3
- else if it contains the string "Gecko", simulate - as of htmlunit - Mozilla 1.0
- else simulate - as of htmlunit - MS IE 6.0

This allowed me in a first time to quickly migrate the "header" functionnality without beeing "too" wrong. I think now 
that we should perhaps provide a finer way to control this settings from a test script. For htmlunit, a "BrowserVersion" 
object has following properties:
     - applicationName - The name of the application
     - applicationVersion - The version string of the application
     - userAgent - The user agent string that will be sent to the server
     - javaScriptVersion - The version of JavaScript

What do you think?

Marc.