1 / 8

HtmlUnit

HtmlUnit. Martin Liersch. Overview. What is HtmlUnit? Difference to HttpUnit Installation Important functions. What is HtmlUnit?. „htmlunit is a java unit testing framework for testing webbased applications“ http://htmlunit.sourceforge.net/index.html

sass
Télécharger la présentation

HtmlUnit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HtmlUnit Martin Liersch

  2. Overview • What is HtmlUnit? • Difference to HttpUnit • Installation • Important functions

  3. What is HtmlUnit? • „htmlunit is a java unit testing framework for testing webbased applications“ http://htmlunit.sourceforge.net/index.html • With htmlunit you can simulate a webbrowser and check the requested webpage. • Licencse: apache style license http://htmlunit.sourceforge.net/license.html

  4. Difference to HttpUnit HttpUnit HtmlUnit Htmlunit models the requested webpage Htmlunit deals with the document: Pages Tables Frames Forms … • Httpunit models the http protocol • Httpunit deals with the http protocol: • http-requests • http-responses

  5. Installation • Download HtmlUnit: http://downloads.sourceforge.net/htmlunit/htmlunit-1.10.zip • Extract it to any directory • Include it in your projects BuildPath

  6. Important functions • WebClient: • Constructor: WebClient(BrowserVersion, ProxyServer) • getPage(String): Page, getPage(URL): Page • HtmlPage: • asText(): String, asXml(): String • getFormByName(String): HtmlForm/ getForms(): List • getFrameByName(String): FrameWindow / getFrames(): List • getHtmlElementById(String): HtmlElement • getTitleText(): String / setTitleText(String) • pressAccessKey(char)

  7. Important functions • HtmlForm • getActionAttribute(): String • getId(): String • getInputByName(String): HtmlInput • getHtmlElementByTagName(String): HtmlElement • getOnSubmitAttribute(): String • setValueAttribute(String) • Submit()

  8. Thanks for your attention. Anyquestions? Sources: http://htmlunit.sourceforge.net

More Related