|
使用JWebUnit1.2,应用是基于struts的。
错误堆栈是:
ReferenceError: "submit" is not defined.
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
at org.mozilla.javascript.ScriptRuntime.getBase(ScriptRuntime.java:1110)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2006)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:5
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent
(JavaScript.java:162)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent
(ScriptableDelegate.java:55)
at com.meterware.httpunit.WebRequestSource.submitRequest
(WebRequestSource.java:224)
at com.meterware.httpunit.WebLink.click(WebLink.java:90)
at net.sourceforge.jwebunit.HttpUnitDialog.submitRequest(HttpUnitDialog.java:573)
at net.sourceforge.jwebunit.HttpUnitDialog.clickLinkWithText(HttpUnitDialog.java:655)
at net.sourceforge.jwebunit.WebTester.clickLinkWithText(WebTester.java:885)
at net.sourceforge.jwebunit.WebTestCase.clickLinkWithText(WebTestCase.java:359)
at com.fifa.test.jwebunit.CopyOfLoginPageTest.loginAs(CopyOfLoginPageTest.java:73)
......
测试代码:
private void loginAs(String user, String pass) {
beginAt("/app");
setFormElement("username", user);
setFormElement("password", pass);
clickLinkWithText("login");
}
登陆链接的html代码是:
<tr class="normal">
<td align="right"><a class="command-button" onclick="submit()"
href="#">login</a></td>
</tr>
不知到为什么会出现这个问题,难道是JWebTest对javascript的支持不够好,还是JWebTest对
javascript使用的要求比较高? |
|