It was actually setScriptingEnabled :). It works now with javascript disabled. Thanks for the help!
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Henry Sent: Wednesday, January 24, 2007 9:52 AM To: Usage problems for JWebUnit Subject: Re: [JWebUnit-users] Re : Problem with javascript Hi Julien, The real HTML code on the page is actually pretty much the same as the jsp. I've been looking at HttpUnit page and just noticed they only have minimal javascript support. I believe the javascript that is being used is for validation of the form data, so I might be out of luck. My IDE can't seem to find the setJavaScriptEnabled method, do you happen to know off the top of your head what I might have to import for it? Thanks for your help! Here is the code from my browser: <fieldset> <legend>Story Action</legend> <input type="hidden" name="_flowExecutionKey" value="_cIwjttIwsbaSEhaCN_kC8029369-B86C-E18E-9F36-30581369C2A1"> <input type="submit" class="button" name="_eventId_save" value="Save Changes" /> <input type="submit" class="button" name="_eventId_cancel" value="Cancel" immediate="true" id="Cancel" /> </fieldset> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Julien HENRY Sent: Wednesday, January 24, 2007 9:37 AM To: Usage problems for JWebUnit Subject: [JWebUnit-users] Re : Problem with javascript Hi Alexander, If the JavaScript in your page is only cosmetic, you may try to disable it temporarily: setJavaScriptEnabled(false); //problematic code setJavaScriptEnabled(true); However, you should really try to write a minimal test case with HtmlUnit that reproduce your bug and submit it on HtmlUnit bug tracker. Another point: could you please give us the real HTML code of the page (the one you get in your browser). ++ Julien ----- Message d'origine ---- De : Alexander Henry <[EMAIL PROTECTED]> À : [email protected] Envoyé le : Mercredi, 24 Janvier 2007, 17h58mn 16s Objet : [JWebUnit-users] Problem with javascript When I try to click the save or cancel button, I am getting an exception. It appears to be a problem with javascript being read. Anyone know of a way to get this working or a work around? The exception happens on the line this.clickButton("Cancel") Here is the code on the page: <fieldset> <legend>Story Action</legend> <input type="hidden" name="_flowExecutionKey" value="<c:out value="${flowExecutionKey}"/>"> <input type="submit" class="button" name="_eventId_save" value="Save Changes" /> <input type="submit" class="button" name="_eventId_cancel" value="Cancel" immediate="true" id="Cancel" /> </fieldset> Here is my jWebUnit code: public void testLinks() { beginAt("/flows.html?_flowId=story-flow"); try{ this.assertTitleEquals(""); this.assertTablePresent("storyListTable"); this.clickLinkWithText("Update"); this.assertTextPresent("Last Major Edit Date:"); this.clickButton("Cancel"); //this.submit("_eventId_save"); }catch(AssertionFailedError e){ System.out.println("Assertion failure:" + e.toString().replaceAll("junit.framework.AssertionFailedError:", "")); } System.out.println("Test link done"); } } Here is the exception that I get: Exception in thread "main" java.lang.RuntimeException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read property "explicitOriginalTarget" from undefined (http://localhost:8080/rb-spinner/includes/js/vegas-validation.js#46) at net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.clickButton(HtmlUnitDia log.java:1708) at net.sourceforge.jwebunit.junit.WebTester.clickButton(WebTester.java:1911 ) at webTest.testLinks(webTest.java:27) at webTest.<init>(webTest.java:13) at Test.main(Test.java:3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read property "explicitOriginalTarget" from undefined (http://localhost:8080/rb-spinner/includes/js/vegas-validation.js#46) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(J avaScriptEngine.java:319) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfP ossible(HtmlPage.java:737) at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:164) at com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSub mitInput.java:78) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableEleme nt.java:114) at net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.clickButton(HtmlUnitDia log.java:1706) ... 9 more Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "explicitOriginalTarget" from undefined (http://localhost:8080/rb-spinner/includes/js/vegas-validation.js#46) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3 226) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3 216) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3232) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3251) at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3 264) at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:13 21) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2815) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java :149) at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2169 ) at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:254) at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:124) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3084) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java :149) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCal l(HtmlUnitContextFactory.java:151) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java :147) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(J avaScriptEngine.java:314) ... 14 more ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ JWebUnit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ JWebUnit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ JWebUnit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ JWebUnit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users
