Headless Mode to be Supported in Chrome and Firefox Browsers

Good news! You can now use Chrome browser without display… Wait… What? While most users want to actually see the page they load in a web browser, some may want to run their browser in a server without display. Headless mode in web browsers can be used for automated testing requiring loading web pages, extracting metadata, generating bitmaps from page contents, etc…

It’s been possible to do so in the past using Xvfb to emulate a framebuffer tricking the browsers to believe there was a display in Linux. But now headless mode is build-in right into browsers, so you don’t need X server running at all, and beside Linux, it will also work in Windows, and Mac OS.

You can launch headless mode in Chrome 59 (currently in dev channel) as follows:


You may want to add --disable gpu option to remove an error message. Then go to http://localhost:9222, or http://IP:9222 is you using an actual server in order to open the DevTools interface.

Google also mentions Selenium tool for automated testing, as well as use Node.js or a C++ API to extract data.

Google Chrome won’t be the only browser to support headless mode, as Firefox developers have also been working on it, and it might already work (or not) with nightly builds. To enable it, run the command below:


Via Edibel

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
2 Comments
oldest
newest
zoobab
7 years ago

I made some simple expect script to scrape webpages with the Firefox Scrapbook plugin, which can be called from a Telnet interface to Firefox, can´t remember the name.

Also this selenium stuff worked like a charm to take screenshots:

https://github.com/pimuzzo/selenium-python-xvfb

I had a hard time to find out how to save in HTML and render the javascript with the following code in python:

# render the javascript here
html = self.browser.execute_script(“return document.getElementsByTagName(‘html’)[0].innerHTML”)

Drone
Drone
7 years ago

Or something like wget or similar?

Boardcon Rockchip and Allwinner SoM and SBC products