From: Tsukasa <Ts...@os...> - 2008-10-28 17:31:41
|
Hi, I'm just starting to think I'm blind. I try to create testcases for a GWT application. Every test worked fine until that application was upgraded to GWT 1.5.2 (in fact the application itself runs without any problem in real browsers). Now I don't even get the first click() working. The code below should just get a menuitem and click it. Thereafter a popupmenu should open and so on. The problem is, that after executing ContentMenuItem.click(); JavaScriptEngine catches the following Exception: [main] INFO com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine - Caught script exception ======= EXCEPTION START ======== EcmaError: lineNumber=[59] column=[0] lineSource=[null] name=[TypeError] sourceName=[script in http://WebApp/ C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13)] message=[TypeError: Cannot find function contai ns in object [object]. (script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13)#59)] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function contains in object [object]. (script in h ttp://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13)#59) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528) at org.mozilla.javascript.Context.call(Context.java:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:437) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:917) at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.ja va:143) at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContain er.java:156) at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:550) at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1251) at org.mozilla.javascript.Context.call(Context.java:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1255) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:136) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76) at test.TestWebApp.generateNewContent(TestWebApp.java:204) at test.StandaloneTest.main(StandaloneTest.java:23) Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot find function contains in object [object]. (script in htt p://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13)#59) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3558) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3536) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3564) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3583) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3647) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2187) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3170) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:170) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3004) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:465) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:430) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522) ... 16 more Enclosed exception: org.mozilla.javascript.EcmaError: TypeError: Cannot find function contains in object [object]. (script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13)#59) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3558) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3536) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3564) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3583) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3647) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2187) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3170) at script.gmb(script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13 ):59) at script.nkc(script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13 ):1007) at script.dlc(script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13 ):1023) at script.vSb(script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13 ):279) at script(script in http://WebApp/C8330EC42EA3CFE93A3FEFD2717BF909.cache.html from (1, 395) to (3860, 13):30 1) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:170) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3004) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:465) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:430) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522) at org.mozilla.javascript.Context.call(Context.java:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:437) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:917) at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.ja va:143) at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContain er.java:156) at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:550) at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1251) at org.mozilla.javascript.Context.call(Context.java:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1255) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:136) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76) at test.TestWebApp.generateNewContent(TestWebApp.java:204) at test.StandaloneTestDFS21.main(TestWebApp.java:23) == CALLING JAVASCRIPT == function () { var c = CUb; CUb = this; if ($wnd.event.returnValue == null) { $wnd.event.returnValue = true; if (!xSb($wnd.event)) { CUb = c; return; } } var b, a = this; while (a && !(b = a.__listener)) { a = a.parentElement; } if (b) { if (b != null && avb(b.tI, 11) && !(b != null && (b.tM != Dwe && b.tI != 2))) { vSb($wnd.event, a, b); } } CUb = c; } ======= EXCEPTION END ======== The method I wrote is: public void generateNewContent(String URL, String BrowserType, String propertyFile) throws IOException, DatabaseUnitException, SQLException { BrowserVersion Browser; PROPERTY_wait = 5; if (BrowserType.equals("IE6")) { Browser = BrowserVersion.INTERNET_EXPLORER_6_0; } else if (BrowserType.equals("IE7")) { Browser = BrowserVersion.INTERNET_EXPLORER_7_0; } else if (BrowserType.equals("FF2")) { Browser = BrowserVersion.FIREFOX_2; } else if (BrowserType.equals("FF3")) { Browser = BrowserVersion.FIREFOX_3; } else { Browser = BrowserVersion.INTERNET_EXPLORER_6_0; } webClient = new WebClient(Browser); webClient.setThrowExceptionOnFailingStatusCode(false); // since some pages are giving 503 webClient.setThrowExceptionOnScriptError(false); // since htmlunit detect some errors in the javascripts HtmlPage htmlpage = (HtmlPage) webClient.getPage(URL); htmlpage.getEnclosingWindow().getThreadManager().joinAll(PROPERTY_wait * 1000); // MenuItem "Content" HtmlTableCell ContentMenuItem = (HtmlTableCell) htmlpage.getElementById("gwt-uid-3"); // click Menuitem "Content" try { ContentMenuItem.click(); } catch (IOException e) { throw new IOException("Clicking 'Content' menu-item failed"); } // wait for htmlpage to refresh (popup opens) htmlpage.getEnclosingWindow().getThreadManager().joinAll(PROPERTY_wait * 100); /*.... */ } I would be glad, if anybody could open my eyes for my fault or could it be something in HU? (in that case, please tell me, what else should be provide to analyze the problem) Thanks Tsukasa -- View this message in context: http://www.nabble.com/need-help-with-GWT-1.5.2-application-creating-com.gargoylesoftware.htmlunit.ScriptException-tp20212092p20212092.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |