[Webtest] A problem with <clickbutton...> used with image buttons
Carsten Seibert
webtest@lists.canoo.com
Fri, 26 Apr 2002 07:03:03 +0200
Hi Stephen
Well, currently is the image button feature still kind of "experimental".
That's why there no documentation yet. But there is a functional test in
selfTestImpl.html (testClickButton) which seems to run fine.
In order to help us reproducing the problem could you please provide a
minimal WebTest script and the corresponding HTML page used by the test?
Thanks,
Carsten
Carsten Seibert
seiberTEC GmbH Switzerland
mailto:seibert@seibertec.ch / phone: +41 79 636 4317
> -----Original Message-----
> From: stephen_peterson@agilent.com
> [mailto:stephen_peterson@agilent.com]
> Sent: Donnerstag, 25. April 2002 22:57
> To: webtest@gate.canoo.com
> Subject: [Webtest] A problem with <clickbutton...> used with image
> buttons
>
>
> Hi,
>
> I am using WebTest to check HTML that uses
>
> <form method="POST" action=...>
> ....
> <input type="image" name="myButton" src=...>
> </form>
>
> And a WebTest step
>
> <clickbutton stepid="click image button" name="myButton"
> x="0" y="0"/>
>
> NOTE: the x and y attributes are not specified in syntax.html, but are
> supported by ClickButton.
>
> The form is submitted with all the appropriate parameters
> *except* the X and
> Y values (for
> the HTML snippet above there should be two additional parameters:
> myButton.x and
> myButton.y).
>
> What seems to be happening is:
>
> If HttpUnitOptions.getParameterValuesValidated() is true
> (which seems to be
> the default),
> then the WebRequest constructed by
> ButtonByXxx.locateRequest() uses WebForm
> as
> the ParameterHolder. The problem:
> WebForm.selectImageButtonPosition() only
> sets the
> button location with SubmitButton.setLocation() and does not
> generate the
> ".x" and ".y"
> parameters. The result is these parameters are missing from the POST
>
> However, if HttpUnitOptions.getParameterValuesValidated() is
> false, then the
> WebRequest is
> constructed using new UncheckedParameterHolder( WebForm) as the
> ParameterHolder (see
> WebRequest.newParameterHolder() ).
> UncheckedParameterHolder.selectImageButtonPosition()
> adds the ".x" and ".y" parameters to the request.
>
> I have verified that my tests work as expected (e.g. include
> the ".x" and
> ".y" parameters
> are included) by modifying ClickButton.doExecute() to
>
> protected void doExecute(TestContext context) throws Exception {
> boolean oldValue =
> HttpUnitOptions.getParameterValuesValidated();
> HttpUnitOptions.getParameterValuesValidated( false );
>
> /* the original contents of doExecute() go here */
>
> HttpUnitOptions.getParameterValuesValidated(
> oldValue );
> }
>
> HttpUnitOptions.getParameterValuesValidated() enables /
> disables an error
> check for
> parameter values that cannot be set via the browser -- hence
> turning this
> off is not a great
> solution.
>
> Does anyone have another way to solve this problem?
>
> Thank you.
>
> Stephen
>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest