Wednesday, January 24, 2007


I have found an open source project which can help me to implement browser objects for my bot. This tool can be very useful for testing web applications. It is HtmlUnit. Very nice idea. But JavaScript support isn't so good as in browser ! Here is an example what you can do with HtmlUnit

final WebClient webClient = new WebClient();
final URL url = new URL("");
System.out.println("Starting at URL : "+url.toString());
final HtmlPage page = (HtmlPage)webClient.getPage(url);
List anchors = page.getAnchors();
//lets go to the first link at page
HtmlPage p = ((HtmlAnchor)anchors.get(0)).click();

JavaScript support is implemented with the help of Rhino, Web client - wrapper for commons httpclient. It is all OK, but all this stuff do not works with my JavaScript... damn !

No comments: