HtmlUnit is a "browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.

It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating either Firefox or Internet Explorer depending on the configuration you want to use.

It is typically used for testing purposes or to retrieve information from web sites.

Journal Entries

No entries yet. Link your entries with 'HtmlUnit' to include this project.


Ratings & Reviews

Community Rating
4.8/5.0

Based on 10 user ratings.

Your Rating

Click to rate this project.

about 1 year ago Avatar
Test and automation tool

    by Bart Hanssens

One of my favorite java-libraries. Actually, I don't use it as a test tool, but as an automation / site scraping tool.
Some javascript perfomance issues left aside, it's very good.

Was this review helpful to you? |

Links

0 links submitted so far. Submit your own links.

News

Edit RSS feeds.

    2009 JavaOne HtmlUnit technical session online content

    HtmlUnit is a pure java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms, clicking links, accessing attributes and values of specific elements within the pages, you do not have to create lower-level requests ... [More] of TCP/IP or HTTP, but just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.

    The most common use of HtmlUnit is test automation of web pages, but sometimes it can be used for web scraping, or downloading website content.

    2009 JavaOne conference website now has the online version of the technical session "HtmlUnit: An Efficient Approach to Testing Web Applications
    TS-4238"

    You can view it at http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-4238&yr=2009&track=soa (0 comments) [Less]

    HtmlUnit 2.5, a headless java browser, released

    A new release of the GUI-Less java browser is available, which allows high-level manipulation of web pages, such as filling forms, clicking links, accessing attributes and values of specific elements within the pages; you do not have to create ... [More] lower-level requests of TCP/IP or HTTP, but just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.

    The most common use of HtmlUnit is test automation of web pages (even with complex JavaScript libraries, like jQuery and Google Web Toolkit), but sometimes it can be used for web scraping, or downloading website content.

    The main enhancements of this release:
    - Improved JavaScript support, particularly full support for MooTools, adding to already supported Google Web Toolkit, jQuery, Mochikit and Sarissa
    - Repackaged Rhino classes to allow the use of HtmlUnit and a regular Rhino version in the same project
    - Support all HTML elements
    - Experimental WebClient.waitForBackgroundJavaScript() and WebClient.waitForBackgroundJavaScriptStartingBefore() for simple, fast and deterministic AJAX testing
    - Reworked handling of background JavaScript tasks using Java 5 executors
    - And as usual, various bug fixes

    You can find more information in the official website (http://htmlunit.sourceforge.net/), the development team is looking forward to getting your feedback. (0 comments) [Less]

    HtmlUnit in JavaOne

    HtmlUnit is a pure java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms, clicking links, accessing attributes and values of specific elements within the pages, you do not have to create lower-level requests ... [More] of TCP/IP or HTTP, but just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.

    The most common use of HtmlUnit is test automation of web pages, but sometimes it can be used for web scraping, or downloading website content.

    2009 JavaOne, the biggest Java conference in San Francisco (May 31 - June 05), is going to include a session titled "HtmlUnit: An Efficient Approach to Testing Web Applications", presented by committers Daniel Gredler and Ahmed Ashour.

    Attendees will learn about
    - The two approaches to Web app integration testing: browser simulation and browser driving
    - The cons of the browser simulation approach
    - The pros of the browser simulation approach
    - Key extension points provided by HtmlUnit
    - Wrappers that enable you to hedge your bets and switch between the two approaches

    More information can be found in http://java.sun.com/javaone/2009/sessions.jsp (0 comments) [Less]

    HtmlUnit: implementation charts of the latest snapshot

    HtmlUnit is a pure java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms, clicking links, accessing attributes and values of specific elements within the pages, you do not have to create lower-level requests ... [More] of TCP/IP or HTTP, but just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.

    The most common use of HtmlUnit is test automation of web pages, but sometimes it can be used for web scraping, or downloading website content.

    JavaScript support is one of the powerful features of HtmlUnit, to the extent that all tests pass of complex JavaScript libraries like jQuery, Google Web Toolkit, MochiKit and Sarissa.

    Still frequently it is asked: "it works for many sites, but not always identical to the real browsers, so how similar is it compared to mine?"

    There is a Continuous Integration process which provides the latest snapshot and now it also gives detailed information about which properties or methods that are implemented, missing, or incorrectly added. The reports are individually made for the supported browsers, namely Internet Explorer 6/7, and Firefox 2/3.

    You can view the charts and the web reports in the 'Build Artifacts' area of the Cruise Control server at http://build.canoo.com/htmlunit, which always includes the latest snapshot after each commit.

    The main website (http://htmlunit.sourceforge.net/) has more information about the project, the development team is looking forward for getting your feedback. (0 comments) [Less]

    HtmlUnit: All HTML elements are now included in HtmlUnit

    HtmlUnit is a "browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.

    In SVN version ... [More] , HtmlUnit has recently added all HTML elements (some are rarely used), which may have some backward compatibility effect in the next version 2.5

    For example, <b> was evaluated to HtmlUnknownElement, but now will be HtmlBold.

    The complete list includes: HtmlAbbreviated, HtmlAcronym, HtmlBackgroundSound, HtmlBig, HtmlBlink, HtmlBold, HtmlCitation, HtmlCode, HtmlDefinition, HtmlEmphasis, HtmlExample, HtmlItalic, HtmlKeyboard, HtmlListing, HtmlMarquee, HtmlMultiColumn, HtmlNoBreak, HtmlNoEmbed, HtmlPlainText, HtmlS, HtmlSample, HtmlSmall, HtmlSpacer, HtmlStrike, HtmlStrong, HtmlSubscript, HtmlSuperscript, HtmlTeletype, HtmlUnderlined and HtmlVariable.

    Feel free to get latest snapshot from http://build.canoo.com/htmlunit/artifacts

    Enjoy testing! (0 comments) [Less]

Read all HtmlUnit articles…

Download Page
29 downloads

Who uses HtmlUnit?

Avatar Avatar Avatar Avatar Avatar Avatar Avatar Avatar Avatar Avatar Avatar Avatar

Who contributes to HtmlUnit?

Avatar Avatar Avatar Avatar Avatar Avatar Anon32 Anon32
I'm a contributor

Who manages HtmlUnit?

I'm a manager

Where in the world?



Related Projects by Tags

Canoo WebTest, Epheket, httpunit, Mozilla Firefox, PHPSpec



Project Cost

This calculator estimates how much it would cost to hire a team to write this project from scratch. More »
Include
Codebase 420,424
Effort (est.) 111 Person Years
Avg. Salary $ year
$ 6,111,145