Chrome Flags Reference

Chrome command line switches and startup flags for automation, headless mode, and debugging.

--keep-alive-for-test

What does --keep-alive-for-test do?

Used for testing - keeps browser alive after last browser window closes.

Usage

CLILaunch Chrome with --keep-alive-for-test using CLI

chrome --keep-alive-for-test

PuppeteerLaunch Chrome with --keep-alive-for-test using Puppeteer

const browser = await puppeteer.launch({
  args: ['--keep-alive-for-test']
});

PlaywrightLaunch Chrome with --keep-alive-for-test using Playwright

const browser = await chromium.launch({
  args: ['--keep-alive-for-test']
});

SeleniumLaunch Chrome with --keep-alive-for-test using Selenium

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--keep-alive-for-test')

driver = webdriver.Chrome(options=options)