World Library  
Flag as Inappropriate
Email this Article


Initial release May 22, 2002 (2002-05-22)
Stable release 2.18 / July 26, 2015 (2015-07-26)
Written in Java
Operating system Cross-platform (JVM)
Available in English
Type Web browser
License Apache License 2.0

HtmlUnit is a headless web browser written in Java. It allows high-level manipulation of websites from other Java code, including filling and submitting forms and clicking hyperlinks. It also provides access to the structure and the details within received web pages. HtmlUnit emulates parts of browser behaviour including the lower-level aspects of TCP/IP and HTTP. A sequence such as getPage(url), getLinkWith("Click here"), click() allows a user to navigate through hypertext and obtain web pages that include HTML, JavaScript, Ajax and cookies. This headless browser can deal with HTTPS security, basic http authentication, automatic page redirection and other HTTP headers. It allows Java test code to examine returned pages either as text, an XML DOM, or as collections of forms, tables, and links.[1]

The goal is to simulate real browsers; namely Chrome, Firefox ESR 38, Internet Explorer 8 and 11, and Edge (experimental).

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.


  • Benefits 1
  • Drawbacks 2
  • Used technologies 3
  • Libraries using HtmlUnit 4
  • See also 5
  • References 6
  • External links 7


  • Provides high-level API, taking away lower-level details away from the user.[2]
  • Compared to other WebDriver implementations, HtmlUnitDriver is the fastest implementation.[3]
  • It can be configured to simulated specific Browser.


  • Elements layout and rendering can not be tested.[4]
  • The JavaScript support is still not complete. And this is usually the main area of enhancements.

Used technologies

Libraries using HtmlUnit

See also


  1. ^ "HtmlUnit Home". Retrieved 23 December 2010. 
  2. ^ "Next Generation Java Testing: TestNG and Advanced Concepts". 
  3. ^ "HtmlUnit Driver". 
  4. ^ "Testing HTML Unit". 

External links

  • HtmlUnit
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.