667481 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 16 Messages: 16 Messages: 16 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

HtmlUnit 2.4, a headless java browser, released

Posted by: Ahmed Ashour on December 31, 2008 DIGG
A new release of the pure GUI-Less browser is available, which allows high-level manipulation of web pages, such as filling forms, clicking links, accessing attributes and values of specific elements within the pages, you do not have to create lower-level requests of TCP/IP or HTTP, but just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed.

The most common use of HtmlUnit is test automation of web pages (even with complex JavaScript libraries, like jQuery and Google Web Toolkit), but sometimes it can be used for web scraping, or downloading website content.

The main enhancements:
  • Improved JavaScript support, now all jQuery and Mochikit tests pass, adding to already supported GWT and Sarissa

  • Native ActiveX support

  • Initial applets handling

  • Support for Internet Explorer conditional comments

  • And as usual, various bug fixes

You can find more information in the official website, the development team is looking forward to getting your feedback.

Threaded replies

·  HtmlUnit 2.4, a headless java browser, released by Ahmed Ashour on Wed Dec 31 08:15:14 EST 2008
  ·  Jmeter? by Andrew Replogle on Wed Dec 31 09:54:42 EST 2008
    ·  Re: Jmeter? by Marc Guillemot on Fri Jan 02 04:06:40 EST 2009
    ·  comparisons by peter shield on Sun Nov 08 14:46:38 EST 2009
  ·  Comparisons by Jeff Segal on Wed Dec 31 09:56:40 EST 2008
    ·  Re: Comparisons by Ruslan Zenin on Wed Dec 31 10:06:45 EST 2008
    ·  Re: Comparisons by Ahmed Ashour on Wed Dec 31 10:13:15 EST 2008
    ·  Re: Comparisons by Time Passx on Wed Dec 31 13:34:55 EST 2008
      ·  Re: Comparisons by Paul King on Thu Jan 01 19:38:07 EST 2009
        ·  Re: Comparisons by Time Passx on Fri Jan 02 09:53:41 EST 2009
      ·  Re: Comparisons by Ingo Boegemann on Mon Jan 05 13:33:38 EST 2009
        ·  wonderful by Auj Lazaro on Fri Nov 06 03:29:02 EST 2009
  ·  Re: sesli by Time Passx on Wed Dec 31 13:59:31 EST 2008
  ·  HtmlUnit and JWebPane : a good match ? by Dominique De Vito on Fri Jan 02 09:09:24 EST 2009
  ·  Compare with HTTPClient by Venkatt Guhesan on Fri Jan 02 16:49:39 EST 2009
    ·  Re: Compare with HTTPClient by Ahmed Ashour on Sat Jan 03 00:37:55 EST 2009
  ·  Re: HtmlUnit 2.4, a headless java browser, released by john kendy on Mon Nov 16 10:14:24 EST 2009
  Message #297996 Post reply Post reply Post reply Go to top Go to top Go to top

Jmeter?

Posted by: Andrew Replogle on December 31, 2008 in response to Message #297979
I wonder how easily this could be implemented as a plugin to jmeter. I know one of the toughest thing about managing more dynamic apps and workflows are getting the regex's correct and hoping the pre-processors work.

With something like HtmlUnit you wouldn't have to digg through the posts and responses (with the exception of assertions), just interface with the app more naturally.

Sounds cool.

  Message #297997 Post reply Post reply Post reply Go to top Go to top Go to top

Comparisons

Posted by: Jeff Segal on December 31, 2008 in response to Message #297979
This sounds pretty nice, but I'd still be worried about differences in behavior between this and the browsers I'm actually targeting.

I'm also curious if there are tools with similar functionality (whether Java-based or not).

  Message #297998 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Ruslan Zenin on December 31, 2008 in response to Message #297997
... but I'd still be worried about differences in behavior between this and the browsers I'm actually targeting...

From documentation:
Specifying this BrowserVersion will change the user agent header that is sent up to the server and will change the behavior of some of the JavaScript.

public void homePage_Firefox() throws Exception {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_2);
final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
}


  Message #297999 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Ahmed Ashour on December 31, 2008 in response to Message #297997
This sounds pretty nice, but I'd still be worried about differences in behavior between this and the browsers I'm actually targeting.
That depends, if your web application doesn't use JavaScript or your application include jQuery, GWT, Mochikit, and/or sarissa, you will have exact behavior as FF2/FF3/IE6/IE7, because HtmlUnit tests already include actual test cases/examples of those libraries.

If you use Prototype, Ext JS, Dojo, YUI, you will have some successful cases, and some unsuccessful ones.

HtmlUnit has a real active community; some bugs are fixed in few hours if they are simple. If you have a minimal test case, expect a quick response.

  Message #298090 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Time Passx on December 31, 2008 in response to Message #297997
HtmlUnit is a great library, we can't get by without it. We have 100s of automated downloads that would require users to navigate websites and download reports. Websites targeted use heavy javascript and a mixture of plain html, jsp, coldfusion.

We used HttpUnit years ago, that was probably the first hit on google at the time. But no one touched it for several years, so we moved off it and on to this library.

I used another tool at one company called iMacros. It's not free and runs strictly on Windows. The only nice thing that you could do is record as you're clicking through the site. Although very simple, it's painful to write the HtmlUnit code for larger tests. One idea would be an automatic code generator via firefox addon that would generate a good starting point.

  Message #298106 Post reply Post reply Post reply Go to top Go to top Go to top

Re: sesli

Posted by: Time Passx on December 31, 2008 in response to Message #297979
When is that captcha going to be implemented again? At least this list has a nice selection... and transsexuals, so nobody feels left out.

  Message #298887 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Paul King on January 01, 2009 in response to Message #298090
... One idea would be an automatic code generator via firefox addon that would generate a good starting point.


Have you tried the WebTestRecorder firefox plugin?

WebTest is a thin layer over the top of HtmlUnit which let's you write your tests in Ant (if you have folk comfortable with XML) or Groovy (if you have folk comfortable with Java or scripting). We use the latter as part of a testing DSL. We tend to heavily refactor what a recorder gives us but it makes a great start for tedious pages.

  Message #298915 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Jmeter?

Posted by: Marc Guillemot on January 02, 2009 in response to Message #297996
I believe as well that HtmlUnit has a great role to play in load testing (in fact some users already use it for this purpose). Personally I think that it is too low level to effectively write large test suites and I prefer to use WebTest for that.

For a few month, I've started the integration of WebTest with JMeter:
http://mguillem.wordpress.com/2008/05/23/webtesthtmlunit-integration-with-jmeter-started/
but I haven't made any progress since this date as I didn't find free time to work on it.

  Message #298965 Post reply Post reply Post reply Go to top Go to top Go to top

HtmlUnit and JWebPane : a good match ?

Posted by: Dominique De Vito on January 02, 2009 in response to Message #297979
At first sight, from a very high level point of view, it looks like the JWebPane project (the GUI part) to come and the HtmlUnit (the non-GUI part) match well.
May be an interesting match to come...

Dominique
http://www.jroller.com/dmdevito

  Message #298967 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Time Passx on January 02, 2009 in response to Message #298887
No I haven't, that's basically what I was looking for, thx

  Message #298994 Post reply Post reply Post reply Go to top Go to top Go to top

Compare with HTTPClient

Posted by: Venkatt Guhesan on January 02, 2009 in response to Message #297979
How does this compare with HttpClient (from Apache)?
http://hc.apache.org/httpclient-3.x/

I have used HttpClient and I'm trying to find out if someone has used both so that they can compare and contrast the two tools.

V

  Message #299185 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Compare with HTTPClient

Posted by: Ahmed Ashour on January 03, 2009 in response to Message #298994
How does this compare with HttpClient (from Apache)?
http://hc.apache.org/httpclient-3.x/

HttpClient is actually used by HtmlUnit. HttpClient is a powerful library for lower layer HTTP requests, but doesn't handle JavaScript/browser objects/DOM etc, what are all handled by HtmlUnit.

  Message #299633 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Comparisons

Posted by: Ingo Boegemann on January 05, 2009 in response to Message #298090
I believe that PushToTest (http://www.pushtotest.com/) can translate both TestGen4Web as well as Selenium tests into HtmlUnit tests

  Message #328910 Post reply Post reply Post reply Go to top Go to top Go to top

wonderful

Posted by: Auj Lazaro on November 06, 2009 in response to Message #299633
This is another wonderful innovation that has come!

Keep it coming guys. ;)

Thanks!

web hosting

  Message #328971 Post reply Post reply Post reply Go to top Go to top Go to top

comparisons

Posted by: peter shield on November 08, 2009 in response to Message #297996
Lot's of people are in a credit crunch and cash advance loans are the only thing people have to turn to. There are a few legit places to get a cash advance you just have to be careful.

  Message #329184 Post reply Post reply Post reply Go to top Go to top Go to top

Re: HtmlUnit 2.4, a headless java browser, released

Posted by: john kendy on November 16, 2009 in response to Message #297979
Thanks for sharing!
Business Data Analysis
Computer Consultants

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map