Check out
HttpUnit Here's a short description of it:
The normal way to access web sites is via a browser; however, there are times when it is desirable to bypass the browser and access a site from a program, including:
* automated web site testing
* using a web-site as part of a distributed application
HttpUnit makes this easy. Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages as text, an XML DOM, or containers of forms, tables, and links.
hope that helps!