[Webtest] clickbutton with button tag

Dierk Koenig webtest@lists.canoo.com
Tue, 29 Oct 2002 19:28:56 +0100


Hi,

after switching to the latest version of httpunit, I assumed
supporting the button tag would be easy. 
I learned (again) never to assume that something is easy in
software development.

While httpunit finds that button and and correctly returns a 
submitbutton instance, that button does not behave like an
input type submit. We need to explicitely call the
onclick handler.
While the appropriate methods are implemented for getting
the WebRequest needed in the ButtonLocator, e.g.
WebForm.submit(SubmitButton), they are final protected.

Hm - I guess I'm just too tired to see the solution...

Erik, maybe you like to try.

cheers
Mittie


> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of
> Erik.Ostermueller@alltel.com
> Sent: Dienstag, 6. August 2002 20:09
> To: webtest@lists.canoo.com
> Subject: RE: [Webtest] clickbutton with button tag
> 
> 
> OK.  I just did some hunting and found this code in HttpUnit.
> Look at line 8.  This shows that HttpUnit is at least TRYING to load
> <button> nodes.
> Unfortunately, this is with 1.4.1 HttpUnit code.
> Has anyone tried WebTest with HttpUnit 1.4.1 (WebTest ships with
> HttpUnit 1.3, yes?)?
> 
> 1    static FormControl newFormParameter( WebForm form, Node node ) {
> 2        if (node.getNodeType() != Node.ELEMENT_NODE) {
> 3            return null;
> 4        } else if (node.getNodeName().equals( "textarea" )) {
> 5            return new TextAreaFormControl( node );
> 6        } else if (node.getNodeName().equals( "select" )) {
> 7            return new SelectionFormControl( node );
> 8        } else if (node.getNodeName().equals( "button" )) {
>             final String type = NodeUtils.getNodeAttribute( node,
> "type", "submit" );
>             if (type.equalsIgnoreCase( "submit" )) {
>                 return new SubmitButton( form, node );
>             } else {
>                 return null;
>             }
> 
> -----Original Message-----
> From: Dierk Koenig [mailto:dierk.koenig@canoo.com]
> Sent: Tuesday, August 06, 2002 12:26 PM
> To: webtest@lists.canoo.com
> Subject: RE: [Webtest] clickbutton with button tag
> 
> 
> Hi Ben,
> 
> I don't claim this solution to be the only way to go.
> 
> Using WebForm makes it very to do the associated "submit" with
> all the parameters filled correctly.
> 
> still thinking
> Mittie
> 
> 
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On
> Behalf Of Ben Cox
> Sent: Dienstag, 6. August 2002 18:54
> To: webtest@gate.canoo.com
> Subject: Re: [Webtest] clickbutton with button tag
> 
> 
> Dierk,
>   While I understand that the getSubmitButtons() function doesn't find
> <button> tags, I don't see why it's strictly necessary to implement it
> this
> way.  Couldn't there another piece of logic in the same function
> searching
> for all of the <button> tags when the getSubmitButtons() fails?
> Wouldn't
> require editing HttpUnit.
> 
>     Ben
> 
> Dierk Koenig wrote:
> 
> Hi Erik,
> 
> it is weird, but <clickbutton> does not find the <button> tag, although
> this
> is
> proper html 4.0.
> 
> Reason is, that we relay the call to httpunit's
> WebForm.getSubmitButtons()
> method
> that in turn only looks for the input type submit and not for button
> tags.
> 
> Fixing this requires looking for the latest httpunit changes and
> eventually
> updating or otherwise submitting some changes to httpunit itself.
> 
> I will follow up, but I cannot promise a date.
> 
> Meanwhile you will not be able to use <clickbutton> in your example.
> Changing the webapp to using the input type=submit style would do the
> trick but is like a step backwards from the webapp perspective.
> 
> Maybe it is possible to <invoke> the form with predefined parameters(?).
> 
> cheers
> Mittie
> 
> 
> 
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of
> Erik.Ostermueller@alltel.com
> Sent: Dienstag, 6. August 2002 17:31
> To: webtest@lists.canoo.com
> Subject: RE: [Webtest] cruisecontrol
> 
> 
> The doc for <clickbutton> shows that it supports
> html like this:
> 
> <INPUT type="submit"  value="doIt" />
> 
> 
> My html button looks a bit different:
> 	<button type="submit"  ID="idSearchButton" CLASS="button">
>                         Search
> 	</button>
> 
> What should my <clickbutton> look like for the above 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
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>