[Webtest] Exception with Javascript

Maarten Donders webtest@lists.canoo.com
Wed, 8 Sep 2004 15:45:15 +0200


Hi all,

I have a problem which was mentioned on this list some time ago (Jul 2003)
with clicklink submitting a form by a javascript-function.
However I couldn't find the solution to the problem in the archives. Does
anyone remember the solution?

thanks,
Maarten Donders

Here is the original problem as posted by Brandon Moore:

-------------------------------

I put up a test webpage that looks like this:

<html>
  <head>
    <title>Javascript Test</title>
  </head>
  <body>
    <form id=3D"testForm" action=3D"http://www.google.com">
      <input name=3D"button" type=3D"SUBMIT">
    </form>
    <a href=3D"javascript:document.forms[0].submit()">click</a>

  </body>
</html>

My test script invokes the page, uses clicklink with label "click", and
crashed:

java.lang.NoClassDefFoundError:
com/meterware/httpunit/javascript/JavaScript$Form
	at inv1.invoke()
	at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
	at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
	at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
	at org.mozilla.javascript.gen.c1.call(httpunit:0)
	at org.mozilla.javascript.gen.c1.exec(httpunit)
	at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
	at org.mozilla.javascript.Context.evaluateString(Context.java:784)
	at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.getURLConte=
nts
(JavaScript.java:176)
	at
com.meterware.httpunit.scripting.ScriptableDelegate.evaluateURL(Scriptabl=
eDe
legate.java:70)
	at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:157)
	at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:117)
	at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:110)
	at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:91)
	at com.meterware.httpunit.WebClient.getResponse(WebClient.java:87)
	at
com.canoo.webtest.steps.request.Target.getResponse(Target.java:263)
	at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:219)
	at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:186)
	at
com.canoo.webtest.steps.request.ClickLink.doExecute(ClickLink.java:48)
	at com.canoo.webtest.steps.Step.execute(Step.java:59)
	at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)
	at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask=
.ja
va:55)
	at org.apache.tools.ant.Task.perform(Task.java:341)
	at org.apache.tools.ant.Target.execute(Target.java:309)
	at org.apache.tools.ant.Target.performTasks(Target.java:336)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
	at org.apache.tools.ant.Main.runBuild(Main.java:609)
	at org.apache.tools.ant.Main.start(Main.java:196)
	at org.apache.tools.ant.Main.main(Main.java:235)