开发者

httpUnit error in java

hello i am using httpUnit and i have the following error

org.mozilla.javascript.EcmaError: TypeError: Cannot find function attachEvent in object [object Image]. at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3743) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2247) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175) at org.mozilla.javascript.Context.evaluateString(Context.java:1104) at com.meterware.httpunit.javascript.ScriptingEngineImpl.runScript(ScriptingEngineImpl.java:92) at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:88) at com.meterware.httpunit.parsing.NekoDOMParser.runScript(NekoDOMParser.java:151) at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150) at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131) at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136) at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038) at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:48) at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:271) at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1301) at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1285) at com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:1024) at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179) at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:315) at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:526) at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:201) at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183) at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158) at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:199) at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183) at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158) at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:125) at com.meterware.httpunit.WebClient.getResponse(WebClient.java:96) at websitereader.Main.main(Main.java:83) Exception in thread "main" com.meterware.httpunit.ScriptException: Scrip开发者_JS百科t '(function(){ var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j

and i am using netbeans and adding the jar rhino1_7R2( js, js14) and httpunit-1.7

how can i solve it


The first line of your stack trace says:

org.mozilla.javascript.EcmaError: TypeError: Cannot find function attachEvent in object [object Image]

Well, this could possibly mean that an object called Image doesn't have a function called attachEvent which you're calling somewhere. And since you didn't provide the relevant bit of source code, it's just a guess.

By the way, this line

(function(){ var b,d,e,f;function g(a,c)

scares me. I hope you aren't actually going to really leave those variables named like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜