Hi there,
I'm using jwebUnit with HtmlUnit plugin and I would like to have a
simple way to retrieve a submit button by value.

I haven't seen any immediate method to do this, so i managed to write
a method myself in HtmlUnitDialog class. I hope it will be useful to
anyone who have got the same problem and i hope that Julien add this
(or similar) feature to retrieve a submit button by value.

It would be useful to handle that kinds of button throgh "clickButton" method.
Do you need developers Julien ? :-)

*****
    public HtmlSubmitInput getSubmitButtonWithText(String valueText) {          
        List l = ((HtmlPage) win.getEnclosedPage()).getDocumentElement()
                .getHtmlElementsByAttribute("input", "type", "submit");         
        for (int i = 0; i < l.size(); i++) {
            HtmlElement e = (HtmlElement) l.get(i);

            if (((HtmlSubmitInput) e).getValueAttribute().equals(valueText))
                return (HtmlSubmitInput) e;
        }
        return null;
    }

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to