Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)
edited by

I am trying to understand the testing framework better and been looking into Selenium. I've used HTMLUnit before, mainly when I needed to scrape some information off-website or likes.

In the context of writing test automation, what's the advantage/disadvantages of Selenium vs HTMLUnit? Looks to me Selenium is more complicated to set up than HTMLUnit, although at the same time there's an HTMLUnitDriver for Selenium which I think to behave the exact same way as in HTMLUnit itself?

Selenium obviously provides a more robust framework, it has the Selenium RC for parallel testing, it also has different browser drivers that can be used - although when you used the browser drivers, the test will actually open/close a browser application rather than headless.

Maybe I am not understanding Selenium correctly. Some directions and pointers would be great!

On another note - a separate question - I am also looking at doing automated testing on a mobile browser, I see that Selenium has an IPhoneDriver for it, but then this is not headless testing either as it requires actual iOS simulator.

Is there any way to do headless testing on mobile sites? Would changing user-agent be sufficient? I've seen a couple of posts around changing user-agent that seem to have their own challenges, eg. Set user-agent in Selenium RC

Thanks a lot!


1 Answer

+1 vote
by (62.9k points)
selected by
Best answer

Selenium and HTMLUnit are somewhat similar in concept, but Selenium is more mature/robust and has a lot more features.

Note that Selenium encompasses the recording (IDE) plugin for Firefox, which allows you to record tests and the RC/WebDriver automation framework which essentially drives a browser. The two can be used together to make test creation very easy.

The only advantage I could see to using HTMLUnit is that it is less resource-intensive, so you could potentially run tests on less hardware, but with Selenium's parallel support even that isn't really true anymore.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s advanced Selenium training!

Browse Categories