[Webtest] Re: NullPointer Exception at clicklink

Atkinson, John (AGRE) webtest@lists.canoo.com
Thu, 25 Mar 2004 11:01:39 -0700


Ok, I changed it to set window.location instead of calling the=
 window.navigate function.  The test now passes.  I further updated=
 Page1.html to use a form and call form.submit with method=3D"POST" and=
 action=3D"Page2.html" and tried running the webtest again.  It fails this=
 time with a ClassCast Exception.  I opened the page myself in IE and=
 Mozilla and it works in both when I click the link.  Any Ideas?

Regards,
John

P.S.  The new source for Page1.html is below:

Page1.html
--------------------------------------------------------------------------
<HTML>
  <HEAD>
    <TITLE>TEST PAGE 1</TITLE>
  </HEAD>

  <BODY>

    <FORM method=3D"POST" name=3D"Form1" action=3D"Page2.html">

    </FORM>

    <A HREF=3D"javascript:gotonextpage()">PAGE2</A>
   =0D
    <SCRIPT LANGUAGE=3DJavaScript>
      function gotonextpage()
      {
          document.forms[0].submit();
      }
    </SCRIPT>
  </BODY>
</HTML>
--------------------------------------------------------------------------

-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com]On Behalf Of Marc Guillemot
Sent: Thursday, March 25, 2004 11:42 AM
To: webtest@lists.canoo.com
Subject: Re: [Webtest] Re: NullPointer Exception at clicklink


My Mozilla says:

Error: window.navigate is not a function

It seems to be an IE specific function. This would explain why your webtest=
 doesn't run as expected.

Marc.

Atkinson, John (AGRE) wrote:
> Sure.  See below:
>=0D
> Page1.html
>=
 --------------------------------------------------------------------------
> <HTML>
>   <HEAD>
>     <TITLE>TEST PAGE 1</TITLE>
>   </HEAD>
>=0D
>   <BODY>
>     <A HREF=3D"javascript:gotonextpage()">PAGE2</A>
>   =0D
>     <SCRIPT LANGUAGE=3DJavaScript>
>       function gotonextpage()
>       {
>           window.navigate('Page2.html');
>       }
>     </SCRIPT>
>   </BODY>
> </HTML>
>=
 --------------------------------------------------------------------------
>=0D
> Page2.html
>=
 --------------------------------------------------------------------------
> <HTML>
>   <HEAD>
>     <TITLE>TEST PAGE 2</TITLE>
>   </HEAD>
>=0D
>   <BODY>
>     <A HREF=3D"javascript:gotonextpage()">PAGE1</A>
>   =0D
>     <SCRIPT LANGUAGE=3DJavaScript>
>       function gotonextpage()
>       {
>           window.navigate('Page1.html');
>       }
>     </SCRIPT>
>   </BODY>
> </HTML>
>=
 --------------------------------------------------------------------------
>=0D
> SimpleTest2.xml
>=
 --------------------------------------------------------------------------
> <?xml version=3D"1.0"?>
>=0D
> <project name=3D"SimpleTestJS" default=3D"main" basedir=3D"..">
> =0D
>   <property name=3D"webtest.home" value=3D"C:\Canoo\WebTest" />
>=0D
>   <taskdef file=3D"${webtest.home}/webtestTaskdefs.properties">
>     <classpath>
>       <fileset dir=3D"${webtest.home}" includes=3D"**/lib/*.jar" />
>     </classpath>
>   </taskdef>
>=0D
>   <target name=3D"main">
>     <testSpec name=3D"SimpleTest2">
>       <config
>         host=3D""
>         port=3D"0"
>         basepath=3D"\"
>         summary=3D"false"
>         verbose=3D"true"
>         saveresponse=3D"false"
>         haltonfailure=3D"true"
>         protocol=3D"file"
>       />
>       <steps>
>         <invoke
>           stepid=3D"Start At Page 1"
>           url=3D"C:\HTML\Page1.html"
>         />
>         <verifytitle
>           stepid=3D"Verify That We Are Now On Page 1"
>           text=3D"TEST PAGE 1"
>         />
>         <clicklink
>           stepid=3D"Click Link To Go To Page 2"
>           label=3D"PAGE2"
>         />
>         <verifytitle
>           stepid=3D"Verify That We Are Now On Page 2"
>           text=3D"TEST PAGE 2"
>         />
>       </steps>
>     </testSpec>
>   </target>
> </project>
>=
 --------------------------------------------------------------------------
>=0D
> How It Ran:
>=
 --------------------------------------------------------------------------
> C:\Canoo\WebTest\doc\tests>ant -buildfile SimpleTest2.xml
> Buildfile: SimpleTest2.xml
>=0D
> main:
>=0D
> BUILD FAILED
> Test step verifytitle named "Verify That We Are Now On Page 2" failed=
 with message "Wrong document title found! Expected "TEST PAGE 2" but got=
 "TEST PAGE 1""
>=0D
> Total time: 3 seconds
>=
 --------------------------------------------------------------------------
>=0D
>=0D
> Hope this helps,
> John
>=0D
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Marc Guillemot
> Sent: Thursday, March 25, 2004 3:31 AM
> To: webtest@lists.canoo.com
> Subject: Re: [Webtest] Re: NullPointer Exception at clicklink
>=0D
>=0D
> Could you write the minimal html page and the corresponding webtest that=
 doesn't work as expected and post it to the
> mailing list?
>=0D
> Marc.
>=0D
> Atkinson, John (AGRE) wrote:
>=0D
>>::Nodz::
>>
>>I had a look at the build number on the website and the one in the=
 build.zip file and saw that the website is marked at 427 and the=
 BuildNumber.txt file in the build.zip file says 428.  I took that to mean=
 that Canoo's server had "done it's job," so I downloaded the new build,=
 re-tried my test and found that I no longer get the NullPointer Exception.=
  However the test still fails with a message indicating that my page never=
 changed.  I wrote a quick little test that uses a single link using a=
 javascript function that just calls window.navigate and this too fails in=
 the same way, so I doubt that it's an issue with form population.
>>
>>Just letting you know what I've seen in hopes that it will help with an=
 eventual solution.
>>
>>Regardz,
>>John
>>
>>-----Original Message-----
>>From: webtest-admin@lists.canoo.com
>>[mailto:webtest-admin@lists.canoo.com]On Behalf Of Dan Hagberg
>>Sent: Wednesday, March 24, 2004 3:23 PM
>>To: webtest@lists.canoo.com
>>Subject: RE: [Webtest] Re: NullPointer Exception at clicklink
>>
>>
>>
>>It appears that the change is now in the current build (427).  Well at=
 least I think it is.  I no longer get the NullPointerException, but none=
 of the form fields are submitted.  I have a clickbutton test that submits=
 the form and another that uses a clicklink to submit the form.  When=
 submitting the form using the <clickbutton> step, the test works.  When=
 using <clicklink>, it fails.  Is it possible that only a partion of the=
 changes made it into the build?
>>
>>Thanks,
>>Dan
>>
>>-----Original Message-----
>>From: Marc Guillemot [mailto:mguillemot@yahoo.fr]
>>Sent: Wednesday, March 24, 2004 9:56 AM
>>To: webtest@lists.canoo.com
>>Subject: Re: [Webtest] Re: NullPointer Exception at clicklink
>>
>>
>>As said, it has been integrated but no build has been performed since the=
 integration. It just depends when Canoo's
>>server does its job.
>>
>>Marc.
>>
>>Atkinson, John (AGRE) wrote:
>>
>>
>>>Any ideas on when this enhancement will be integrated into WebTest?
>>>
>>>Thanx,
>>>John
>>>
>>>
>>>Marc Guillemot Wrote:
>>>---------------------------------------------------------------------
>>>Webtest doesn't currently handle javascript links. This will be soon the=
 case (I've committed the changes, but the server seems currently not to=
 integrate).
>>>Marc.
>>>
>>>
>>>
>>>John Atkinson Wrote:
>>>---------------------------------------------------------------------
>>>I am trying to fill out an HTML Form and submit the form through the use=
 of Canoo WebTest, but the test is consistantly throwing a Null Pointer=
 Exception at me.  I looked through
>>>some previous posts and found that there was a bug with the clicklink=
 task when the HREF pointed to a javascript function and I think that that=
 might be my problem.  Was that bug ever addressed before build 426 (which=
 is where I am)?
>>>
>>>The link that I'm trying to follow appears like this:
>>><A HREF=3D"javascript:processForm('http://mysite/processForm',=
 'CreateObject', 'class', 'ext.si.MyObject2' )">OK&nbsp;<IMG SRC=
=3D"http://mysite/images/actnlink.gif" ALT=3D"Accept changes" BORDER=
=3D0></A>
>>>
>>>The clicklink task is:
>>><clicklink
>>> stepid=3D"Click OK Link"
>>> label=3D"Accept changes"
>>>/>
>>>
>>>and the stack trace for the exception is:
>>>exception=3D"com.canoo.webtest.engine.StepExecutionException" message=
=3D"Unexpected exception caught:=
 java.lang.NullPointerException">com.canoo.webtest.engine.StepExecutionExce=
ption: Unexpected exception caught: java.lang.NullPointerException, Step:=
 ClickLink at C:\Canoo\WebTest\doc\tests\Modules\createcr.xml:22:  with=
 (label=3D"Accept changes", stepId=3D"Click OK Link", stepType=
=3D"clicklink")&#xd;
>>>	at=
 com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:334)&#xd;
>>>	at=
 com.canoo.webtest.steps.request.Target.protectedGoto(Target.java:115)&#xd;
>>>	at=
 com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:153)&#xd;
>>>	at=
 com.canoo.webtest.steps.request.ClickLink.doExecute(ClickLink.java:36)&#xd=
;
>>>	at com.canoo.webtest.steps.Step.execute(Step.java:99)&#xd;
>>>	at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)&#xd;
>>>	at=
 com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.=
java:68)&#xd;
>>>	at=
 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)&#xd;
>>>	at org.apache.tools.ant.Task.perform(Task.java:364)&#xd;
>>>	at org.apache.tools.ant.Target.execute(Target.java:301)&#xd;
>>>	at org.apache.tools.ant.Target.performTasks(Target.java:328)&#xd;
>>>	at org.apache.tools.ant.Project.executeTarget(Project.java:1215)&#xd;
>>>	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:383)&#xd;
>>>	at=
 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)&#xd;
>>>	at org.apache.tools.ant.Task.perform(Task.java:364)&#xd;
>>>	at org.apache.tools.ant.Target.execute(Target.java:301)&#xd;
>>>	at org.apache.tools.ant.Target.performTasks(Target.java:328)&#xd;
>>>	at org.apache.tools.ant.Project.executeTarget(Project.java:1215)&#xd;
>>>	at org.apache.tools.ant.Project.executeTargets(Project.java:1063)&#xd;
>>>	at org.apache.tools.ant.Main.runBuild(Main.java:632)&#xd;
>>>	at org.apache.tools.ant.Main.startAnt(Main.java:183)&#xd;
>>>	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)&#xd;
>>>	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)&#xd;
>>>
>>>Any ideas?
>>>
>>>Thanx In Advance,
>>>John S. Atkinson
>>>
>>>
>>>
>>>
>>>
>>></table> </Pre>
>>><HTML>
>>><br>
>>><br>
>>>************************************************<br>
>>>The information contained in, or attached to, this e-mail, may contain=
 confidential information and is intended solely for the use of the=
 individual or entity to whom they are addressed and may be subject to=
 legal privilege.  If you have received this e-mail in error you should=
 notify the sender immediately by reply e-mail, delete the message from=
 your system and notify your system manager.  Please do not copy it for any=
 purpose, or disclose its contents to any other person.  The views or=
 opinions presented in this e-mail are solely those of the author and do=
 not necessarily represent those of the company.  The recipient should=
 check this e-mail and any attachments for the presence of viruses.  The=
 company accepts no liability for any damage caused, directly or=
 indirectly, by any virus transmitted in this email.<br>
>>>************************************************<br>
>>></HTML>
>>>_______________________________________________
>>>WebTest mailing list
>>>WebTest@lists.canoo.com
>>>http://lists.canoo.com/mailman/listinfo/webtest
>>>
>>
>>
>>
>>_______________________________________________
>>WebTest mailing list
>>WebTest@lists.canoo.com
>>http://lists.canoo.com/mailman/listinfo/webtest
>>_______________________________________________
>>WebTest mailing list
>>WebTest@lists.canoo.com
>>http://lists.canoo.com/mailman/listinfo/webtest
>>
>></table> </Pre>
>><HTML>
>><br>
>><br>
>>************************************************<br>
>>The information contained in, or attached to, this e-mail, may contain=
 confidential information and is intended solely for the use of the=
 individual or entity to whom they are addressed and may be subject to=
 legal privilege.  If you have received this e-mail in error you should=
 notify the sender immediately by reply e-mail, delete the message from=
 your system and notify your system manager.  Please do not copy it for any=
 purpose, or disclose its contents to any other person.  The views or=
 opinions presented in this e-mail are solely those of the author and do=
 not necessarily represent those of the company.  The recipient should=
 check this e-mail and any attachments for the presence of viruses.  The=
 company accepts no liability for any damage caused, directly or=
 indirectly, by any virus transmitted in this email.<br>
>>************************************************<br>
>></HTML>
>>_______________________________________________
>>WebTest mailing list
>>WebTest@lists.canoo.com
>>http://lists.canoo.com/mailman/listinfo/webtest
>>
>=0D
>=0D
>=0D
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>=0D
> </table> </Pre>
> <HTML>
> <br>
> <br>
> ************************************************<br>
> The information contained in, or attached to, this e-mail, may contain=
 confidential information and is intended solely for the use of the=
 individual or entity to whom they are addressed and may be subject to=
 legal privilege.  If you have received this e-mail in error you should=
 notify the sender immediately by reply e-mail, delete the message from=
 your system and notify your system manager.  Please do not copy it for any=
 purpose, or disclose its contents to any other person.  The views or=
 opinions presented in this e-mail are solely those of the author and do=
 not necessarily represent those of the company.  The recipient should=
 check this e-mail and any attachments for the presence of viruses.  The=
 company accepts no liability for any damage caused, directly or=
 indirectly, by any virus transmitted in this email.<br>
> ************************************************<br>
> </HTML>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>=0D


_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

</table> </Pre>
<HTML>
<br>
<br>
************************************************<br>
The information contained in, or attached to, this e-mail, may contain=
 confidential information and is intended solely for the use of the=
 individual or entity to whom they are addressed and may be subject to=
 legal privilege.  If you have received this e-mail in error you should=
 notify the sender immediately by reply e-mail, delete the message from=
 your system and notify your system manager.  Please do not copy it for any=
 purpose, or disclose its contents to any other person.  The views or=
 opinions presented in this e-mail are solely those of the author and do=
 not necessarily represent those of the company.  The recipient should=
 check this e-mail and any attachments for the presence of viruses.  The=
 company accepts no liability for any damage caused, directly or=
 indirectly, by any virus transmitted in this email.<br>
************************************************<br>
</HTML>