[Webtest] Enabling JavaScript errors
Matt Raible
webtest@lists.canoo.com
Tue, 15 Apr 2003 11:00:29 -0700
Is this possible to set via Ant? Also, I'm certain that there is no error in
my JavaScript - why does it give me a "ConversionError?"
Matt
> To have HttpUnit ignore JavaScript exceptions on scripts that it
> can't process for some reason, set the following before running Canoo.
>
> HttpUnitOptions.setExceptionsThrownOnScriptError(false);
>
> I added this to the static initializer of
> com.canoo.webtest.ant.TestSpecificationTask. By doing this, I found
> that WebTest was able to process a lot of my JavaScript stuff "out
> of the box".
> (I did end up adding a few of my own tags to WebTest to make even
> more JavaScript Work).
>
> Jeff Nielsen
> Digital Focus
> www.digitalfocus.com
>
> ----- Original Message -----
> From: "Matt Raible" <matt@raibledesigns.com>
> To: <webtest@gate.canoo.com>
> Sent: Wednesday, April 09, 2003 12:44 PM
> Subject: [Webtest] Enabling JavaScript errors
>
> > 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.handleScriptEx
> ce
> > 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)
> > _______________________________________________
> > WebTest mailing list
> > WebTest@lists.canoo.com
> > http://lists.canoo.com/mailman/listinfo/webtest
> >
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
-- Matt Raible, Raible Designs, Morrison CO US
-- Tel: +1 303 979-5340
-- Mob: +1 720 560-8460
-- Fax: +1 508 256-6471
-- Web: http://www.raibledesigns.com