1 message in com.canoo.lists.webtestRE: [Webtest] A problem with <clickbu...| From | Sent On | Attachments |
|---|---|---|
| PETERSON,STEPHEN (A-Sonoma,ex1) | 26 Apr 2002 07:23 | .zip |
| Subject: | RE: [Webtest] A problem with <clickbutton...> used with image but tons![]() |
|---|---|
| From: | PETERSON,STEPHEN (A-Sonoma,ex1) (step...@agilent.com) |
| Date: | 04/26/2002 07:23:35 AM |
| List: | com.canoo.lists.webtest |
| Attachments: | ![]() imagetest.zip - 4k |
Hi Carsten,
I've attached a ZIP with 3 files:
imageButtonPage.htm - a very simple form that uses an image button to submit button.gif - the image for the button used by imageButtonPage.htm imageButtonTest.htm - the test
Unfortunately I don't know how (or if) WebTest can verify the parameters submitted... The HTML has a little bit of JavaScript to display window.location so you can use a browser to see the normal parameters but since WebTest doesn't handle JavaScript this doesn't help. By the way, I only checked the JavaScript on IE 5.01
The only way I know to check the operation of WebTest is to place the HTML and GIF files on a server and use a TCP monitor / sniffer / proxy such as tcpmon (included with Apache Axis and available from http://xml.apache.org/axis/). I used tcpmon with the browser and webtest pointing to localhost:8080 (the tcpmon listen port) and tcpmon redirected the requests to localhost:80.
=========== The request from a browser after clicking the image button ======================
GET /imageButtonPage.htm?textInput=normal+input&imageButton.x=20&imageButton.y=1 5 HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* Referer: http://localhost:8080/imageButtonPage.htm Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) Host: localhost:8080 Connection: Keep-Alive
The important part to note is that the GET includes: imageButton.x=20&imageButton.y=15
=========== The request from WebTest after <clickbutton> on the image button ======================
GET /imageButtonPage.htm?textInput=Normal+input+example HTTP/1.1 Referer: http://localhost:8080/imageButtonPage.htm User-Agent: Java1.3.1_01 Host: localhost:8080 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Note that the parameters for the GET does *not* include imageButton.x or imageButton.y although it does include textInput (an <input type="text"...>). Anything that does not depend on the image button parameters will work fine.
Let me know if I can provide any additional help or information.
Thanks for your time.
Stephen
-----Original Message----- From: Carsten Seibert [mailto:seib...@acm.org] Sent: Thursday, April 25, 2002 10:03 PM To: webt...@gate.canoo.com Subject: RE: [Webtest] A problem with <clickbutton...> used with image buttons
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:seib...@seibertec.ch / phone: +41 79 636 4317
-----Original Message----- From: step...@agilent.com [mailto:step...@agilent.com] Sent: Donnerstag, 25. April 2002 22:57 To: webt...@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 WebT...@lists.canoo.com http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________ WebTest mailing list WebT...@lists.canoo.com http://lists.canoo.com/mailman/listinfo/webtest





.zip