5

I am looking at speeding up my automation using a headless browser.

I tried converting my tests to use PhantomJS but test stability took a big hit. Some pop ups don't seem to render correctly, tests die in the middle of execution with no valuable error displayed.. Has anyone had any luck with headless browser automation in .NET? If so, what browser are you using?

3

Use Selenium Remote Web Driver. As detailed in this SO question

IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit())
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnitWithJavaScript())

I would stick to a non-headless browser. Chrome is the fastest here. It's far easier to debug and, from my experience, even HtmlUnitWithJavaScript JavaScript does not play nice with JavaScript.

2

Option 1: trifleJs

Option 2: Convert HtmlUnit from Java to C#

  • I have used HtmlUnit in its Java form and it is great.
1

If PhantomJS is giving you trouble I do not think there are any good headless alternatives at the moment.

What you could try is setup a Virtualmachine to run the tests against that, this way it runs against a real browser, but its not in the way on your desktop. Even better is to setup a Selenium grid and run the tests there.

If setting up a Virtualmachine or a grid is to much effort have a look at something like Saucelabs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.