Chrome Switches

There are often times when you would want to modify browser preferences to suit your needs. Some preferences are relatively easy to guess and modify as you might have done many a time. This post specifically talks about Chrome. We have already talked about Firefox profile in previous post. It would have been great if we had Chrome Profile handle all preferences, however some of the browser preferences/settings with newer versions of chrome are set through “–switches” instead of a traditional profile. Hence this page.

Chrome Profile Settings (Example):

Each of the profile setting is self-explanatory. The reason I am not focusing on chrome profile is because the most important and value-add browser prefs/settings that matter during automation are mostly available in –switches. Manually, if you are interested to see all the profile settings, you can open your chrome profile directory (Where is my directory) and open the ‘preferences’ file located in the directory. The ‘Preferences’ has json that represents the various profile settings. The full list of profile options are here

Chrome Switches (Example):

Manually, we can see the list of all switches available on chrome by typing chrome://flags in a new tab/window. Below is a screenshot.

Chrome_flags

As you can see below, the ‘–ignore-certificates-errors’ is to ignore any cert errors and move on with the scripts. This typically happens when you visit a https site and you get a message before letting you through the site. So programmatically you can ignore it. You can have multiple switches separated by commas as well.

Sometimes you might want to ‘–disable-pop-blocking’ because the pop up might be a legitimate one from your application. 

Maybe you want to disable automatic translation at other times. So use ‘–disable-translate’ 

If you would like the proxy server information automatically set, instead if you typing it in manually every time, use ‘–proxy-server’

A complete list is provided here on chromium source page

Cucumber Scenario (Example):

Step Definitions: