0

I am curious and cannot find the answer with google. How does a headless browser like phantomjs actually take a screenshot? As the browser is headless how does it render an exact webpage render?

joshweir
  • 5,427
  • 3
  • 39
  • 59

1 Answers1

3

As described here, PhantomJS uses the WebKit rendering engine, like Chrome, Safari, Opera and many other web browsers.

Simply speaking, such a rendering engine takes HTML, CSS, images and other resources as input and computes a graphical representation from them. Browsers take that representation and show it to the user on screen, while PhantomJS directly writes it to an image file. In other words, the same procedure is going on behind the scenes, just with different output targets.

Cedric Reichenbach
  • 8,970
  • 6
  • 54
  • 89