[Webtest] clickButton step giving Exception error
Deware, Vipin (Cognizant)
Deware, Vipin (Cognizant)" <Vipin.Deware@cognizant.com
Mon, 11 Dec 2006 15:55:17 +0530
This is a multi-part message in MIME format.
------_=_NextPart_001_01C71D0E.CB2116BD
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have one webtest which clicks a button. So I have used clickButton step.=
But it is not working.=0D
The step which used in webtest is -=0D
<clickButton description=3D"Click submit button: Search" name=
=3D"submitButton" />
I am getting following error for this step.
exception=3D"com.canoo.webtest.engine.StepExecutionException" message=
=3D"Unexpected exception caught: java.lang.IllegalStateException: Element=
is not comtained within a form: HtmlSubmitInput[<input value=
=3D"Search" type=3D"submit" onclick=
=3D"setActionAndSubmit(this)" name=
=3D"submitButton">]"><![CDATA[com.canoo.webtest.engine.StepExecut=
ionException: Unexpected exception caught: java.lang.IllegalStateException:=
Element is not comtained within a form: HtmlSubmitInput[<input value=
=3D"Search" type=3D"submit" onclick=3D"setActionAndSubmit(this)" name=
=3D"submitButton">], Step: ClickButton at=
C:\Data\Profiles\F214598\Desktop\SimpleTest.xml:13: with (taskName=
=3D"clickButton", name=3D"submitButton")
at com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:475)
at=
com.canoo.webtest.steps.AbstractBrowserAction.handleUnexpectedException(Ab=
stractBrowserAction.java:114)
at=
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.ja=
va:110)
at=
com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(AbstractTa=
rgetAction.java:106)
at=
com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(AbstractTar=
getAction.java:78)
at com.canoo.webtest.steps.Step.execute(Step.java:145)
at org.apache.tools.ant.Task.perform(Task.java:364)
at=
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:=
59)
at=
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:39)
at com.canoo.webtest.steps.Step.execute(Step.java:145)
at org.apache.tools.ant.Task.perform(Task.java:364)
at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:126)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at=
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor=
.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.IllegalStateException: Element is not comtained within=
a form: HtmlSubmitInput[<input value=3D"Search" type=3D"submit" onclick=
=3D"setActionAndSubmit(this)" name=3D"submitButton">]
at=
com.gargoylesoftware.htmlunit.html.HtmlElement.getEnclosingFormOrDie(HtmlE=
lement.java:326)
at=
com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmi=
tInput.java:78)
at=
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement=
.java:116)
at=
com.canoo.webtest.steps.request.ClickButton.findTarget(ClickButton.java:15=
3)
at=
com.canoo.webtest.steps.request.AbstractTargetAction$1.call(AbstractTarget=
Action.java:108)
at=
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.ja=
va:88)
... 21 more
If I change the type of "input" control to "button" rather than "submit",=
the test works fine.=0D
I have also attached sample webtest & html file with this mail for the=
reference.
Thanks and Regards,
Vipin
Vipin Deware (KSDA 341)
Uetlibergstrasse 231 (A/B+ZN)
CH-8045 Z=FCrich-Uetlihof
Phone: +41 44 33 46436
This e-mail and any files transmitted with it are for the sole use of the=
intended recipient(s) and may contain confidential and privileged=
information.
If you are not the intended recipient, please contact the sender by reply=
e-mail and destroy all copies of the original message.=0D
Any unauthorised review, use, disclosure, dissemination, forwarding,=
printing or copying of this email or any action taken in reliance on this=
e-mail is strictly=0D
prohibited and may be unlawful.
Visit us at http://www.cognizant.com
------_=_NextPart_001_01C71D0E.CB2116BD
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=
=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version=
6.5.7651.14">
<TITLE>clickButton step giving Exception error</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<P><FONT SIZE=3D2>Hi,<BR>
<BR>
I have one webtest which clicks a button. So I have used clickButton step.=
But it is not working.<BR>
<BR>
The step which used in webtest is -<BR>
<BR>
<clickButton description=
=3D"Click submit button: Search" name=3D"submitButton"=
/><BR>
<BR>
I am getting following error for this step.<BR>
<BR>
<BR>
exception=3D"com.canoo.webtest.engine.StepExecutionException"=
message=3D"Unexpected exception caught:=
java.lang.IllegalStateException: Element is not comtained within a form:=
HtmlSubmitInput[&lt;input value=3D&quot;Search&quot; type=
=3D&quot;submit&quot; onclick=
=3D&quot;setActionAndSubmit(this)&quot; name=
=3D&quot;submitButton&quot;>]"><![CDATA[com.canoo.web=
test.engine.StepExecutionException: Unexpected exception caught:=
java.lang.IllegalStateException: Element is not comtained within a form:=
HtmlSubmitInput[<input value=3D"Search" type=
=3D"submit" onclick=3D"setActionAndSubmit(this)" name=
=3D"submitButton">], Step: ClickButton at=
C:\Data\Profiles\F214598\Desktop\SimpleTest.xml:13: with (taskName=
=3D"clickButton", name=3D"submitButton")<BR>
at=
com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:475)<BR>
at=
com.canoo.webtest.steps.AbstractBrowserAction.handleUnexpectedException(Ab=
stractBrowserAction.java:114)<BR>
at=
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.ja=
va:110)<BR>
at=
com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(AbstractTa=
rgetAction.java:106)<BR>
at=
com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(AbstractTar=
getAction.java:78)<BR>
at=
com.canoo.webtest.steps.Step.execute(Step.java:145)<BR>
at=
org.apache.tools.ant.Task.perform(Task.java:364)<BR>
at=
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:=
59)<BR>
at=
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:39)=
<BR>
at=
com.canoo.webtest.steps.Step.execute(Step.java:145)<BR>
at=
org.apache.tools.ant.Task.perform(Task.java:364)<BR>
at=
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:126)<BR>
at=
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)<BR>
at=
org.apache.tools.ant.Task.perform(Task.java:364)<BR>
at=
org.apache.tools.ant.Target.execute(Target.java:341)<BR>
at=
org.apache.tools.ant.Target.performTasks(Target.java:369)<BR>
at=
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)<BR>
at=
org.apache.tools.ant.Project.executeTarget(Project.java:1185)<BR>
at=
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor=
.java:40)<BR>
at=
org.apache.tools.ant.Project.executeTargets(Project.java:1068)<BR>
at=
org.apache.tools.ant.Main.runBuild(Main.java:668)<BR>
at=
org.apache.tools.ant.Main.startAnt(Main.java:187)<BR>
at=
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)<BR>
at=
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)<BR>
Caused by: java.lang.IllegalStateException: Element is not comtained within=
a form: HtmlSubmitInput[<input value=3D"Search" type=
=3D"submit" onclick=3D"setActionAndSubmit(this)" name=
=3D"submitButton">]<BR>
at=
com.gargoylesoftware.htmlunit.html.HtmlElement.getEnclosingFormOrDie(HtmlE=
lement.java:326)<BR>
at=
com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmi=
tInput.java:78)<BR>
at=
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement=
.java:116)<BR>
at=
com.canoo.webtest.steps.request.ClickButton.findTarget(ClickButton.java:15=
3)<BR>
at=
com.canoo.webtest.steps.request.AbstractTargetAction$1.call(AbstractTarget=
Action.java:108)<BR>
at=
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.ja=
va:88)<BR>
... 21 more<BR>
<BR>
If I change the type of "input" control to "button"=
rather than "submit", the test works fine.<BR>
<BR>
I have also attached sample webtest & html file with this mail for the=
reference.<BR>
<BR>
Thanks and Regards,<BR>
<BR>
Vipin<BR>
Vipin Deware (KSDA 341)<BR>
Uetlibergstrasse 231 (A/B+ZN)<BR>
CH-8045 Z=FCrich-Uetlihof<BR>
Phone: +41 44 33 46436<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>
<table><tr><td bgcolor=3D#ffffff><font color=3D#000000>This e-mail and any=
files transmitted with it are for the sole use of the intended=
recipient(s) and may contain confidential and privileged information.<br>
If you are not the intended recipient, please contact the sender by reply=
e-mail and destroy all copies of the original message. <br>
Any unauthorised review, use, disclosure, dissemination, forwarding,=
printing or copying of this email or any action taken in reliance on this=
e-mail is strictly <br>
prohibited and may be unlawful.<br>
<br>
Visit us at http://www.cognizant.com<br>
</font></td></tr></table>
------_=_NextPart_001_01C71D0E.CB2116BD--