What is Chrome Option in Selenium?

1. ChromeOptions in Selenium which will help to manage options like (browser in headless mode, disable info bar, add Extensions, setBinary, Load default or custom profile) to Chrome Driver.

2. ChromeOptions class extends MutableCapabilities.

3. If you want to pass any capabilities, try to use ChromeOptions.

Ex.1.  Chrome Automation Info-bar

           ChromeOptions options = new ChromeOptions();

    //disable automation info bar

    options.addArguments(“disable-infobars”);

  1. Load Default/Custom Chrome Profile :-

       options.addArgument(“user-data-dir=/path/to/your/custom/profile”);

  1. Using a Chrome executable in a non-standard location :-

           options.setBinary(“/path/to/other/chrome/binary”);

  1. Headless Chrome

    options.setHeadless(true);

  1. Load Extensions

String extFilePath = “D:/extensions/file.extension”; ChromeOptions options = new ChromeOptions(); options.addExtensions(new File(extFilePath));

finally write below line

WebDriver driver = new ChromeDriver(options);

6. To accept untrusted certificate
options.sertAcceptInsecureCerts(true);

Shashank is an information technology graduate, keen observer and a perfection seeker. Passionate about browser as well as Robotic Process Automation