Headless Browser
What a headless browser is, how it's used for automated screenshots, and common pitfalls.
A headless browser is a web browser that runs without a visible window and is controlled by code. It uses the same engine as the normal browser: it parses HTML, runs JavaScript, computes layout and renders pixels, but draws them into an off-screen buffer.
Chrome and Firefox both have headless modes. Programs control them through protocols such as the Chrome DevTools Protocol, WebDriver and WebDriver BiDi. Libraries such as Puppeteer, Playwright and Selenium wrap these protocols in a programming API.
Because nothing is drawn on screen, a headless browser can run on servers and in CI pipelines that have no display.
How headless browsers work
- A script launches the browser in headless mode.
- It opens a page, sets the viewport size and loads a URL.
- It waits for an event, such as the load event or no network activity.
- It runs actions, such as clicks or scrolling, and then requests a screenshot or a PDF.
- It closes the page or the browser.
Where headless browsers are used
- Automated tests that check pages and flows.
- Scheduled screenshots for monitoring and archiving.
- Generating PDFs and social preview images from HTML.
- Collecting public data from pages that need JavaScript to render.
Headless vs headed capture
| Headless | Headed (visible window) | |
|---|---|---|
| Display needed | No | Yes |
| Speed for batches | Usually faster | Slower |
| Debugging | Harder, nothing to watch | Easier |
| Detection by sites | More likely | Less likely |
Some sites detect headless browsers and serve different content or block them. Fonts and GPU features can also differ from a desktop browser, so the same page can render slightly differently.
Common mistakes
- Capturing at the load event on pages that keep loading content.
- Forgetting to set the viewport, so every capture uses a default size.
- Running many browsers at once on a small machine.
- Missing fonts on servers, which changes text layout.
Taking the same screenshots again and again?
Temposhot Website Capture loads URLs in managed local browsers on your Mac without code, with 1 to 10 Concurrent browsers. See website screenshot automation.
Common questions
Do I need to write code to use a headless browser?
Libraries such as Puppeteer and Playwright require code. Desktop tools and screenshot services hide that layer.
Is a headless screenshot identical to a normal one?
Often close, but fonts, GPU rendering and site behavior can differ.
Sources
Related resources
- Automate website screenshots with Playwright: a code example.
- Automate website screenshots with Puppeteer: a code example.
- Website Capture quick start: the no-code option.
Taking the same screenshots again and again?
Temposhot captures a screen, window or area on a timer and exports the set as a PDF, images, ZIP or MP4. The free browser tools fix single images.
Related resources
Related terms
- PuppeteerWhat Puppeteer is, how it captures screenshots, and how it compares to Playwright for browser automation.
- PlaywrightWhat Playwright is, how it captures cross-browser screenshots, and how it compares to Puppeteer for automation.
- Batch ScreenshotWhat batch screenshots are, how they differ from single captures, and where teams use them.
- Screenshot APIWhat a screenshot API is, how it works, and when to use one for programmatic capture.
- Visual Regression TestingWhat visual regression testing is, how screenshot comparison catches UI bugs, and common pitfalls.
- Web CrawlerHow web crawlers work, the difference between crawling and scraping, and how crawlers are used with screenshot capture tools.
- Web ScrapingWhat web scraping is, how it relates to screenshot capture, and legal and ethical considerations.