Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
This is currently the fastest and most lightweight implementation of WebDriver. As the name suggests, this is based on HtmlUnit.
- Fastest implementation of WebDriver
- A pure Java solution and so it is platform independent.
- Emulates other browser's JS behaviour (see below)
HtmlUnitDriver driver = new HtmlUnitDriver(true);
Emulating a Specific Browser
Notwithstanding other considerations above, it is possible to get HtmlUnitDriver to emulate a specific browser. You should not really be doing this, as web-applications are better coded to be neutral of which reasonably recent browser you are using. There are two more constructors for HtmlUnitDriver that take allow us to indicate a browser to emulate. One takes a browser version directly:
HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_3);
The other uses a broader capabilities mechanism:
HtmlUnitDriver driver = new HtmlUnitDriver(capabilities);