[Webtest] Enabling JavaScript errors

Matt Raible webtest@lists.canoo.com
Wed, 9 Apr 2003 09:44:49 -0700


I'm trying to turn on JavaScript in my webtest tests, and I'm getting the 
following error.  The method I used to turn on JavaScript was adding js.jar 
to my classpath.

Thanks,

Matt

failed: ConversionError: The undefined value has no properties. 

Full Details:

file:c:/Source/cct/dbping.xml:42: Test failed.
Exception raised: com.meterware.httpunit.ScriptException: Script 'if 
(getCookie("username") != null)
 {
        document.getElementById("j_username").value = getCookie("username");
        document.getElementById("j_password").focus();
    } else {
        document.getElementById("j_username").focus();
    }

    function saveUsername(theForm) {
        var expires = new Date();
        expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // 
sets it for approx 30 days
.
        setCookie("username",theForm.j_username.value,expires,"/");

        if (theForm.rememberMe.checked) {
            setCookie("password",theForm.j_password.value,expires,"/");
            setCookie("rememberMe","true",expires,"/");
        }
    }

    function validateForm(form) {
        return validateRequired(form);
    }

    function required () {
        this.aa = new Array("j_username", "E-Mail Address is a required 
field.", new Function ("varN
ame", " return this[varName];"));
        this.ab = new Array("j_password", "Password is a required field.", 
new Function ("varName",
" return this[varName];"));
    }
// -->' failed: ConversionError: The undefined value has no properties. 
(httpunit; line 238)com.mete
rware.httpunit.ScriptException: Script 'if (getCookie("username") != null) {
        document.getElementById("j_username").value = getCookie("username");
        document.getElementById("j_password").focus();
    } else {
        document.getElementById("j_username").focus();
    }

    function saveUsername(theForm) {
        var expires = new Date();
        expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // 
sets it for approx 30 days
.
        setCookie("username",theForm.j_username.value,expires,"/");

        if (theForm.rememberMe.checked) {
            setCookie("password",theForm.j_password.value,expires,"/");
            setCookie("rememberMe","true",expires,"/");
        }
    }

    function validateForm(form) {
        return validateRequired(form);
    }

    function required () {
        this.aa = new Array("j_username", "E-Mail Address is a required 
field.", new Function ("varN
ame", " return this[varName];"));
        this.ab = new Array("j_password", "Password is a required field.", 
new Function ("varName",
" return this[varName];"));
    }
// -->' failed: ConversionError: The undefined value has no properties. 
(httpunit; line 238)
        at 
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptExce
ption(JavaS
cript.java:176)
        at 
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript
(JavaScript.ja
va:113)
        at com.meterware.httpunit.scripting.ScriptableDelegate.runScript
(ScriptableDelegate.java:55)

        at com.meterware.httpunit.WebResponse$Scriptable.load
(WebResponse.java:574)
        at com.meterware.httpunit.javascript.JavaScript$Window.initialize
(JavaScript.java:364)
        at com.meterware.httpunit.javascript.JavaScript.run
(JavaScript.java:79)
        at com.meterware.httpunit.javascript.JavaScriptEngineFactory.associate
(JavaScriptEngineFacto
ry.java:46)