Hi,
I have one webtest which clicks a button. So I have used clickButton step. But
it is not working.
The step which used in webtest is -
<clickButton description="Click submit button: Search"
name="submitButton" />
I am getting following error for this step.
exception="com.canoo.webtest.engine.StepExecutionException" message="Unexpected
exception caught: java.lang.IllegalStateException: Element is not comtained
within a form: HtmlSubmitInput[<input value="Search"
type="submit" onclick="setActionAndSubmit(this)"
name="submitButton">]"><![CDATA[com.canoo.webtest.engine.StepExecutionException:
Unexpected exception caught: java.lang.IllegalStateException: Element is not
comtained within a form: HtmlSubmitInput[<input value="Search" type="submit"
onclick="setActionAndSubmit(this)" name="submitButton">], Step: ClickButton at
C:\Data\Profiles\F214598\Desktop\SimpleTest.xml:13: with
(taskName="clickButton", name="submitButton")
at com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:475)
at
com.canoo.webtest.steps.AbstractBrowserAction.handleUnexpectedException(AbstractBrowserAction.java:114)
at
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.java:110)
at
com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(AbstractTargetAction.java:106)
at
com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(AbstractTargetAction.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="Search" type="submit"
onclick="setActionAndSubmit(this)" name="submitButton">]
at
com.gargoylesoftware.htmlunit.html.HtmlElement.getEnclosingFormOrDie(HtmlElement.java:326)
at
com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:78)
at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:116)
at
com.canoo.webtest.steps.request.ClickButton.findTarget(ClickButton.java:153)
at
com.canoo.webtest.steps.request.AbstractTargetAction$1.call(AbstractTargetAction.java:108)
at
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.java:88)
... 21 more
If I change the type of "input" control to "button" rather than "submit", the
test works fine.
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ürich-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.
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
prohibited and may be unlawful.
Visit us at http://www.cognizant.com