Difference of Headless browsers for automation
Asked Answered
R

1

6

The main difference is, execution on GUI bases and non GUI bases(Headless).

I am looking for difference between all Headless browsers with each other, But unfortunately I didn't find any. I go through one by one, Which makes more confusion. It would be great if someone can share short information with differences, which makes things clear.

Revolute answered 31/10, 2018 at 12:59 Comment(7)
Hey Ishitha, just FYI, you can find the list of supported browsers by Selenium hereLea
@KireetiAnnamaraj Thanks. I did not glance it on seleniumhq.Revolute
Hi @Ishitha, I see that you have changed the question. However, coming to the performance of headless browsers, I have used all the popular headless browsers like HtmlUnit driver, phantom ghost driver, chrome and ff in headless mode. Though all of them served my purpose of webscraping faster, Html unit driver was a bit faster. You can read about it here. But, on the whole, every headless driver are almost the same with negligible performance differences.Lea
@KireetiAnnamaraj I used to start with Headless from HTMLUnit, chrome-headless and I am getting failure as result. Which can not work for my project framework. I have used JQuery, JS and Angular waiter frequently which makes it failure i think.Revolute
Then the issue seems to be specific to a different concern and most likely not related to headless drivers. you may want to debug the actual issue by posting the error stack trace and your use caseLea
@IshitaShah Can you narrow down your question as ...difference in execution on GUI bases and non GUI bases(Headless)... , ...When to use which browser... , ...Which browsers are better... and ...difference with each other..., all are relatively larger topics to answer as per StackOverflow standards within a single question?Upandcoming
@DebanjanB Reduced question length. Please explain if you can.Revolute
U
27

Browser

A Browser is an application program that provides a way to look at and interact with all the information on the World Wide Web. Technically a Browser, alternatively referred as a Web Browser or Internet Browser, is a client program that uses HTTP (Hypertext Transfer Protocol) to make requests of Web servers throughout the Internet on behalf of the Browser User.


Headless Browser

A Headless Browser is also a Web Browser but without a graphical user interface (GUI) but can be controlled programmatically which can be extensively used for automation, testing, and other purposes.


Why to use Headless Browsers?

There are a lot of advantages and disadvantages in using the Headless Browsers. Using a headless browser might not be very helpful for browsing the Web, but for Automating tasks and tests it’s awesome.


Advantages of Headless Browsers

There is a lot of advantages in using Headless Browsers. Some of tham are as follows:

  • A definite advantage of using Headless Browsers is that they are typically faster than real browsers. The reason for being faster is because we are not starting up a Browser GUI and can bypass all the time a real browser takes to load CSS, JavaScript and open and render HTML DOM.
  • Performancewise you can typically see a 2x to 15x faster performance when using a headless browser.
  • While Scraping Websites you don’t necessarily want to have to manually start up a website. So you can access the website headlessly and just scrape the HTML. You don’t need to render a Full Browser to do that.
  • Lot of developers use a Headless Browser for unit testing code changes for their websites and mobile apps. Being able to do all this from a command line without having to manually refresh or start a browser saves them lots and effort.

When You Might NOT Want to Use a Headless Browser

There can be number of reasons why you may opt to use a Real Browser instead of a Headless Browser. A couple of instances:

  • You need to mimic real users.
  • You need to visually see the test run.
  • If you need to do lots of debugging, headless debugging can be difficult.

Which headless browsers are better?

As you rightly pointed that ...the main difference is in the execution on GUI bases and non GUI bases(Headless)..., so from Testing Perspective a lot will depend on the Browser Engine implemented under the hood by any particular browser. For example, here are some of the Browser Engines which fully render web pages or run JavaScript in a virtual DOM.

  • Chromium Embedded Framework: CEF is a open source project based on the Google Chromium project with JavaScript support and BSD license.
  • Erik: Erik is a Headless Browser on top of Kanna and WebKit with Swift support and MIT license.
  • jBrowserDriver: jBrowserDriver is a Selenium-compatible Headless Browser which is WebKit-based and works with Selenium Server through Java binding support and Apache License v2.0 license.
  • PhantomJS: PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG with JavaScript, Python, Ruby, Java, C#, Haskell, Objective-C, Perl, PHP and R(via Selenium) support and BSD 3-Clause license.
  • Splash: Splash is a javascript rendering service with an HTTP API. It's a lightweight browser with an HTTP API, implemented in Python using Twisted and QT with almost all the laungage binding arts and BSD 3-Clause license.

You can find a related discussion in Which drivers support “no-browser”/“headless” testing?

Upandcoming answered 1/11, 2018 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.