Software:HtmlUnit
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
(Learn how and when to remove this template message)
|
Initial release | May 22, 2002 |
---|---|
Stable release | 3.9.0
/ December 3, 2023 |
Written in | Java |
Operating system | Cross-platform (JVM) |
Available in | English |
Type | Web browser |
License | Apache License 2.0 |
Website | https://htmlunit.sourceforge.io/ |
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
- 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 specific Browser.
Drawbacks
- 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
- W3C DOM
- HTTP connection, using Apache HttpComponents
- JavaScript, using forked Rhino
- HTML Parsing, NekoHTML
- CSS: using CSS Parser
- XPath support, using Xalan
Libraries using HtmlUnit
See also
- Headless system
- Web scraping
- Web testing
- xUnit
- Selenium WebDriver
References
- ↑ "HtmlUnit Home". http://htmlunit.sourceforge.net/.
- ↑ Beust, Cédric; Suleiman, Hani (15 October 2007). Next Generation Java Testing: TestNG and Advanced Concepts. Pearson Education. ISBN 9780132702270. https://books.google.com/books?id=bCvcMcLZwV4C&q=htmlunit&pg=SA4-PA109. Retrieved 30 August 2019.
- ↑ "HtmlUnit Driver". https://github.com/SeleniumHQ/selenium/wiki/HtmlUnitDriver.
- ↑ "Testing HTML Unit". http://www.gwtproject.org/doc/latest/DevGuideTestingHtmlUnit.html.
Bibliography
Further reading
- Langer, A. "Extending HtmlUnit for test automatisation of Web applications using AJAX"; Betreuer/in (nen): T. Grechenig, M. Bernhart; 183/1, 2009. (Subscription content?)
- Massol, Vincent; Timothy M. O'Brien (2005). Maven: A Developer's Notebook. O'Reilly Media. pp. 83–86. ISBN 978-0-596-55297-8. https://archive.org/details/isbn_9788173667916_g4l8/page/83.
- Tahchiev, Petar; Felipe Leme; Vincent Massol (2010). "12. Presentation Layer Testing". JUnit in Action (2 ed.). Manning. pp. 190–208. ISBN 978-1-935182-02-3.
- Harold, Elliotte Rusty (16 March 2012). Refactoring HTML. Addison-Wesley Professional. ISBN 9780132701877. https://books.google.com/books?id=I2MKuc4iZDYC&pg=PA39.
- Tong, Ka Iok (23 April 2006). Enjoying Web Development with Tapestry. TipTec Development. ISBN 9781411649132. https://books.google.com/books?id=p5x9-ZKQF0sC&pg=PA347.
External links
Original source: https://en.wikipedia.org/wiki/HtmlUnit.
Read more |