[Webtest] NullPointerException on clickLink for javascript
Glen Cordrey
webtest@lists.canoo.com
Thu, 5 Feb 2004 08:57:28 -0500
Below is the code where the problem is occuring, with comments added to =
show the results from
debugging so far.
package com.canoo.webtest.steps.request;
...
public abstract class Target extends Step {
...
protected WebResponse getResponse(Context context, String url) throws =
IOException, SAXException {
// a println of url at this point shows it to be the string " =
javascript:document.getElementById('loginForm').submit();"
prepareConversation(context);
WebResponse response =3D =
context.getWebConversation().getResponse(url);
LOG.debug("Target.getResponse");
/// NullPointerException occurs here because response is null
LOG.debug("response.getURL() =3D " + response.getURL());
LOG.debug("response.isHTML() =3D " + response.isHTML());
LOG.debug("response.getText() =3D " + response.getText());
return response;
}
=20
-----Original Message-----
From: Marc Guillemot [mailto:mguillemot@yahoo.fr]
Sent: Thursday, February 05, 2004 3:43 AM
To: webtest@lists.canoo.com
Subject: Re: [Webtest] NullPointerException on clickLink for javascript
No idea.
Have you the stack trace of the root cause, in this case, it would =
probably=20
provide better information.
Marc.
Glen Cordrey wrote:
> Any idea why I'm getting the NullPointerException on the clicklink =
that=20
> I want to exercise the javascript in
> the buttonLink shown below?
> =20
> file:E:/ci/canooTests/auto_search.xml:12: Test failed.
> Exception raised: com.canoo.webtest.engine.StepExecutionException:=20
> Unexpected exception caught: java.lang.NullPointerExc
> eption, Step: ClickLink at with (href=3D"getElementById", =
label=3D"log in",=20
> stepId=3D"Click the submit button", stepType=3D"cli
> cklink")com.canoo.webtest.engine.StepExecutionException: Unexpected=20
> exception caught: java.lang.NullPointerException, St
> ep: ClickLink at with (href=3D"getElementById", label=3D"log in",=20
> stepId=3D"Click the submit button", stepType=3D"clicklink")
> at=20
> com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:343)
> at=20
> com.canoo.webtest.steps.request.Target.protectedGoto(Target.java:115)
> at=20
> com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:153)
> at=20
> com.canoo.webtest.steps.request.ClickLink.doExecute(ClickLink.java:36)
> at com.canoo.webtest.steps.Step.execute(Step.java:103)
> at =
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
> at=20
> =
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask=
.java:61)
> at=20
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
> 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)
> =20
> <clicklink label=3D"log in"=20
> stepid=3D"Click the submit button"/>
> =20
> <a class=3D"buttonLink"
> href=3D"javascript:document.getElementById('loginForm').submit();"
> testId=3D"a_loginSubmit">
> <img align=3D"absmiddle" alt=3D"" border=3D"0" class=3D"buttonImage"
> name=3D"imgBtnArrow" src=3D"images/layout/btn_arrow_r.gif" />
> log in</a>
> =
------------------------------------------------------------------------
>=20
> *Glen Cordrey Convera* =20
>=20
> voice: (410) 740-8800 x1150 http://www.convera.com=20
> <http://www.convera.com/>
> fax: (410) 740-8810
> =20
> =20
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest