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

Reply via email to