Skip to content

erikperez/NHtmlUnit

 
 

Repository files navigation

NHtmlUnit

NHtmlUnit is .NET friendly wrapper for HtmlUnit.

Introduction

We really like the HtmlUnit project, which enables headless web testing without needing to have a complete browser running. By using IKVM it is possible to convert the HtmlUnit Java library for use on Microsoft's .NET platform.

However it doesn't feel very natural to use a java library in a .NET language, and therefore we created an HtmlUnit wrapper written in C#.

Building NHtmlUnit

NHtmlUnit can be built using either MSBuild or Visual Studio 2010.

After building you can find NHtmlUnit.dll plus its dependencies here:

  • app\NHtmlUnit\bin\Debug
  • app\NHtmlUnit\bin\Release

An prepackaged binary is planned for release in the near future.

A package is also available using the NuGet package manager:

NHtmlUnit NuGet package

Usage

For now there is no manual or API reference written for NHtmlUnit.

You can however use the HtmlUnit reference, as this wrapper almost completely reflects the original API.

The difference is that Java iterators, lists and collections are exposed as their .NET-friendly counterparts (IEnumerable, IList and ICollection).

In addition, properties are now "real" .NET properties. obj.getSomething() and obj.setSomething() is exposed as obj.Something;

NHtmlUnitGenerator

This executable only needs to be run when the HtmlUnit jar file has changed!

When NHtmlUnitGenerator is run it will overwrite all files in app\NHtmlUnit\Generated.

Note that it doesn't do anything with the project files, so if classes are added or removed from the origin HtmlUnit jar file this will not be synchronized. You have to manually add new files to the project.

License

NHtmlUnit is licensed under the Apache License Version 2.0, which is the same license used for HtmlUnit.

Tech details

NHtmlUnit has in large parts been autogenerated using the HtmlUnit jar file as input.

Although we consider NHtmlUnit itself to be of decent quality, the NHtmlUnitGenerator is basically a large hack.

Future

A complete rewrite of the NHtmlUnitGenerator using Mono.Cecil would be nice, although we're unsure exactly how much this would do for the final product.

Authours

NHtmlUnit was written by Asbjørn Ulsberg and Karsten Strand at OKB AS.

About

.Net port of HtmlUnit

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE.txt
Unknown
LICENSE-HtmlUnit.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.8%
  • Other 0.2%