Chrome Flags Reference

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

--enable-viewport

What does --enable-viewport do?

Enables the use of the @viewport CSS rule, which allows pages to control aspects of their own layout. This also turns on touch-screen pinch gestures.

Usage

CLILaunch Chrome with --enable-viewport using CLI

chrome --enable-viewport

PuppeteerLaunch Chrome with --enable-viewport using Puppeteer

const browser = await puppeteer.launch({
  args: ['--enable-viewport']
});

PlaywrightLaunch Chrome with --enable-viewport using Playwright

const browser = await chromium.launch({
  args: ['--enable-viewport']
});

SeleniumLaunch Chrome with --enable-viewport using Selenium

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--enable-viewport')

driver = webdriver.Chrome(options=options)