Audience
Java developers wanting a solution to automate web page interactions and perform testing operations
About HtmlUnit
HtmlUnit is a "GUI-Less browser for Java programs" that models HTML documents and provides an API to interact with web pages, such as invoking pages, filling out forms, and clicking links, similar to a standard web browser. It offers fairly good JavaScript support, which is constantly improving and is capable of handling complex AJAX libraries, simulating browsers like Chrome, Firefox, or Edge depending on the configuration used. Typically used for testing purposes or retrieving information from websites, HtmlUnit is not a generic unit testing framework but is intended to simulate a browser within another testing framework such as JUnit or TestNG. It is utilized as the underlying "browser" by various open source tools like WebDriver, Arquillian Drone, and Serenity BDD, and is employed by many projects for automated web testing, including Apache Shiro, Apache Struts, and Quarkus.