1. Omid Sayfun
  2. /
  3. Notebook
  • Home
  • About
  • Notebook
  • Token Usage
  • Whisper Usage
Tools
  • Agent Knowledge Base

List of useful Chrome args

March 10, 2024 · Updated on August 09, 2026

Puppeteer is a Node library, which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. It's primarily used for automating web browser tasks such as testing web applications, taking screenshots of web pages, generating pre-rendered content for websites, and crawling SPAs.

I write short, practical notes like this one. Get the next one by email:

Unsubscribe anytime.

SPAs need a browser that waits for JavaScript

An SPA builds its content with JavaScript after the first response, so a plain HTTP request gives you an empty shell. Puppeteer drives a real browser, so it sees the same DOM a user sees. Four things follow from that:

  1. Dynamic Content Loading: Puppeteer can wait for elements to appear or for certain conditions to be met, making it ideal for testing or scraping SPAs.
  2. JavaScript Execution: It can programmatically trigger events or call JavaScript functions within the page, allowing for interactions that closely mimic those of a real user.
  3. Performance Monitoring and Optimization: Puppeteer can capture metrics like load times, time to interactive, and other crucial performance indicators.
  4. Screenshot and PDF Generation: For documentation, testing, or archiving purposes, Puppeteer can capture screenshots or generate PDFs of SPAs.

Start with the default launch, then add args

This is the smallest script that opens a page and saves a screenshot. It uses no arguments at all:

import puppeteer from "puppeteer";
 
async function takeScreenshot(url: string, filePath: string) {
	const browser = await puppeteer.launch();
	const page = await browser.newPage();
	await page.goto(url, { waitUntil: "networkidle2" });
	await page.screenshot({ path: filePath });
	await browser.close();
}
 
// The screenshot will be saved in the current directory
takeScreenshot("https://omiid.me", "screenshot.png")
	.then(() => console.log("Screenshot taken successfully."))
	.catch((err) => console.error("Error taking screenshot:", err));

Pass Chrome args through puppeteer.launch

Chrome args, also called Chromium flags or Chrome options, are command line switches read by the browser at startup. Puppeteer args live in the args array of the launch options you hand to puppeteer.launch:

const browser = await puppeteer.launch({
	headless: true,
	args: ["--no-sandbox", "--disable-dev-shm-usage"],
});

Those two are the Puppeteer launch args almost every containerized setup needs. Most of the arguments in this list only matter for headless Chrome inside a container such as Docker, where there is no display server and shared memory is small. Here is what each one does:

  • -no-sandbox: Disabling the sandbox is often necessary in containerized environments like Docker, where the sandbox's security restrictions can prevent Chromium from running.
  • -disable-setuid-sandbox: Similar to -no-sandbox, this disables the setuid sandbox, which is another layer of security in Linux. It's also typically used in containerized setups.
  • -disable-gpu: Disables GPU hardware acceleration. This can be useful in environments without a GPU or where GPU usage leads to problems. It might reduce performance in graphics-heavy applications but can reduce resource usage in headless environments.
  • -disable-dev-shm-usage: Instructs Chromium to not use /dev/shm (shared memory) which is limited in size in some environments (like Docker). This can prevent crashes due to running out of shared memory.
  • -disable-accelerated-2d-canvas: Disables hardware acceleration for 2D canvas elements. This can reduce GPU usage, which might be beneficial in server or test environments without dedicated GPU resources.
  • -disable-extensions: Disables all browser extensions. This can speed up startup and reduce potential interference from third-party extensions, ensuring a clean testing or automation environment.
  • -no-first-run: Skips the first run wizard to speed up initialization. This is useful in automated testing or scraping scenarios where you want to minimize startup time and user intervention.
  • -no-zygote: Disables zygote process creation, which is part of Chrome's multi-process architecture. It can have implications for security and stability and is usually used to reduce resource usage in constrained environments.
  • -single-process: Runs the browser with a single process, contrary to the default multi-process architecture. While it can reduce resource usage, it may significantly affect stability and security, making it less suitable for production environments. (I don’t really recommend using this unless you know why you’re using it)
  • -disable-background-timer-throttling: Prevents Chromium from throttling background timers to reduce CPU usage. This can be useful for tests or tasks that need to run in the background without being slowed down.
  • -disable-backgrounding-occluded-windows, -disable-renderer-backgrounding: These flags prevent Chromium from reducing the priority of certain processes or rendering tasks for background or occluded (hidden) windows. They can be useful for ensuring consistent performance for background tasks or tests.
  • -disable-web-security: Disables the same-origin policy, allowing scripts to access resources from any domain. This is a powerful option that can be useful for testing cross-origin requests without CORS policy restrictions but introduces significant security risks. Use it only in controlled, secure environments for testing purposes.

Join My Newsletter

Occasional notes on software, tools, and things I learn. No spam.

Unsubscribe anytime.

Continue Reading

  • Embeddings rot too. Running pgvector in production.Aug 28, 2026
  • Stop shipping retrieval changes on vibesAug 25, 2026
  • Your RAG is confidently wrong without hybrid searchAug 21, 2026
  • Stop tuning everything. pgvector has three knobs that matter.Aug 18, 2026
  • Your agent's knowledge base is lying to you. Run these 14 checks.Aug 18, 2026