Chrome Flags Reference

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

--restore-last-session

What does --restore-last-session do?

Indicates the last session should be restored on startup. This overrides the preferences value. Note that this does not force automatic session restore following a crash, so as to prevent a crash loop. This switch is used to implement support for OS-specific "continue where you left off" functionality on OS X and Windows.

Usage

CLILaunch Chrome with --restore-last-session using CLI

chrome --restore-last-session

PuppeteerLaunch Chrome with --restore-last-session using Puppeteer

const browser = await puppeteer.launch({
  args: ['--restore-last-session']
});

PlaywrightLaunch Chrome with --restore-last-session using Playwright

const browser = await chromium.launch({
  args: ['--restore-last-session']
});

SeleniumLaunch Chrome with --restore-last-session using Selenium

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--restore-last-session')

driver = webdriver.Chrome(options=options)