[Httpunit-develop] WebConversation throwing Javascript error
Brought to you by:
russgold
From: Mark G. <mark.gargan@Allfinanz.com> - 2005-05-23 09:51:40
|
Hey folks, My test that was working on Friday has decided to stop working this morning. I'm getting a problem with the Javascript function that's called when a page is loaded. Here's the javascript function... // Set focus to the first text or select field function focusFirst() { var els = document.mainForm; if (null != els) { var el; for (var i = 0; i < els.length; i++) { el = els[i]; // Avoid "hidden" and "radio" types if ("text" == el.type || "password" == el.type || "select-one" == el.type) { el.focus(); return; } } } } And here's the stack trace from the problem.. undefined: The undefined value has no properties. at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:580) at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:541) at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:700) at org.mozilla.javascript.gen.c1.call(httpunit:14) at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1950) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88) at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(J avaScript.java:172) at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelega te.java:56) at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:689) at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89) at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEng ineFactory.java:58) at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44) at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122) at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113) at com.allfinanz.test.InterviewClient.beginInterview(InterviewClient.java:103) at com.allfinanz.test.InterviewClient.run(InterviewClient.java:359) at com.allfinanz.test.InterviewTest.main(InterviewTest.java:64) com.meterware.httpunit.ScriptException: Event 'javascript:focusFirst();' failed: undefined: The undefined value has no properties. at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptEx ception(JavaScript.java:202) at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(J avaScript.java:175) at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelega te.java:56) at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:689) at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89) at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEng ineFactory.java:58) at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44) at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122) at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113) at com.allfinanz.test.InterviewClient.beginInterview(InterviewClient.java:103) at com.allfinanz.test.InterviewClient.run(InterviewClient.java:359) at com.allfinanz.test.InterviewTest.main(InterviewTest.java:64) Exception in thread "main" Has anyone any idea why this would suddenly start giving me bother? I can request the page no problem from the browser without any problem. Thanks, Mark. Mark Gargan Software Developer Allfinanz Distribution Software <<http://www.allfinanz.com/>> Direct Line: 213 5115 Fax: +353 1 295 2554 <<mailto:mar...@al...>> |