

The -dump-dom flag prints to stdout: chrome -headless -disable-gpu -dump-dom # Create a PDF There are some useful command line flags to perform common tasks. In some cases, you may not need to programmatically script Headless Chrome. If you're on the stable channel of Chrome and cannot get the Beta, I recommend using chrome-canary: alias chrome = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"Īlias chrome-canary = "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"Īlias chromium = "/Applications/Chromium.app/Contents/MacOS/Chromium"ĭownload Chrome Canary here.

Since I'm on Mac, I created convenient aliases for each version of Chrome that I have installed. The exact location will vary from platform to platform. See /737678.Ĭhrome should point to your installation of Chrome. If your tests require a Chrome instance running inside a Docker container, ensure that you add the -no-sandbox value to the args object to access the Chrome binary from the docker container.Note: Right now, you'll also want to include the -disable-gpu flag if you're running on Windows. Using Chrome running in a Docker container "profile.password_manager_enabled" : false The following code snippet shows how to set the preferences if you want to disable the browser's password manager feature in the nightwatch.json file: You can refer to this list of command line switches that you can pass as args to the chromeOptions key under your desiredCapabilities key in your nightwatch.json file as follows:Īpart from the command line switches that you set using the args key, you can also pass the Chrome profile preferences using the prefs key. Nightwatch supports all arguments and capabilities that ChromeDriver provides.Ĭheck out the official ChromeDriver documentation to learn more about these capabilities. Each item in the list should be a base-64 encoded packed Chrome extension (.crx)

e.g., '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')Ī list of Chrome extensions to install on startup. Path to the Chrome executable to use (on Mac OS X, this should be the actual binary, not just the app. Arguments with an associated value should be separated by a '=' sign (e.g., ). List of command-line arguments to use when starting Chrome.
