HtmlUnit

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
HtmlUnit
Initial releaseMay 22, 2002 (2002-05-22)
Stable release
4.15.0 / August 17, 2025; 7 months ago (2025-08-17)
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Written inJava
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemCross-platform (JVM)
    Available inEnglish
    TypeWeb browser
    LicenseApache License 2.0
    Websitehttps://www.htmlunit.org/

    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 and Edge.

    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

    [edit | edit source]
    • Provides high-level API, taking away lower-level details away from the user.[2]
    • Compared to other WebDriver implementations, HtmlUnitDriver is the fastest to implement.[3]
    • It can be configured to simulate a specific browser.

    Drawbacks

    [edit | edit source]
    • Element layout and rendering can not be tested.[4]
    • The JavaScript support is not complete, which is one of the areas of ongoing enhancements.

    Used technologies

    [edit | edit source]

    Libraries using HtmlUnit

    [edit | edit source]

    See also

    [edit | edit source]

    Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

    References

    [edit | edit source]
    1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).

    Bibliography

    [edit | edit source]
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). pp. 339– (subscription required)

    Further reading

    [edit | edit source]
    • Langer, A. "Extending HtmlUnit for test automatisation of Web applications using AJAX"; Betreuer/in (nen): T. Grechenig, M. Bernhart; 183/1, 2009. (subscription required)
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (subscription required)
    [edit | edit source]