I'm using Selenium's WebDriver to run some SpecFlow tests for an ASP.NET MVC app I'm working on for self-education.
Using FirefoxDriver
, ChromeDriver
, etc. all take so long to run, it's actually pretty frustrating to use them (in my opinion).
I have read about an HtmlUnitDriver
that is supposedly much faster than the browser-based drivers; but I can't seem to find a version in the .NET client library (only Java). Is there a .NET version out there?
HTML UnitDriver is the most light weight and fastest implementation headless browser for of WebDriver. It is based on HtmlUnit. It is known as Headless Browser Driver. It is same as Chrome, IE, or FireFox driver, but it does not have GUI so one cannot see the test execution on screen.
HtmlUnitDriver is headless driver providing non-GUI implementation of Selenium WebDriver. It is based on HtmlUnit, fastest and light-weight browser implemented in Java.
htmlunit driver does not support screenshots · Issue #1361 · SeleniumHQ/selenium-google-code-issue-archive · GitHub.
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.
To use HtmlUnit you need to use the RemoteWebDriver and pass in the desired capabilities for it.
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit())
and away you go. If you want the Firefox implementation to run use
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnitWithJavaScript())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With