Jun 18

“You are using an unsupported command-line flag –ignore-certificate-errors. Stability and security will suffer.” Handling in WebDriver using ChromeOptions()

“You are using an unsupported command-line flag –ignore-certificate-errors. Stability and security will suffer.” has become a very annoying message whenever we try to execute our selenium WebDriver script in Chrome with most recently update version of Chrome browser with recently updated Selenium Server Standalone Jar 2.42.0/2.41.0

It look like this
yellow certificate error

I was just exploring internet to find the solution and after half an hours effort has provided this solution to handle this problem with ChromeOptions().

So before going directly to code lets see what is Chrome Options  so for time being take it as Firefox Profile means Chrome Options is also like a folder within Chrome where it stores all its bookmarks, passwords and setting.

Now another question comes in mind “how to use the ChromeOptions class”
Ans:
You can create an instance of ChromeOptions, which has convenient methods for setting ChromeDriver-specific capabilities. You can pass the ChromeOptions object directly into the ChromeDriver constructor
Like this

ChromeOptions options = new ChromeOptions();
options.addArguments("--test-type");
WebDriver    driver = new ChromeDriver(options);

Now we have the way to handle above yellow annoying message by replacing

System.setProperty("webdriver.chrome.driver","Path of ");
   WebDriver driver = new ChromeDriver();

with these line of code

System.setProperty("webdriver.chrome.driver","Path of <chromedriver.exe>");
	        ChromeOptions options = new ChromeOptions();
	        options.addArguments("--test-type");
	        WebDriver driver = new ChromeDriver(options);

Here we have set argument of chrome to –test-type that handles the yellow annoying message when chrome browser first launched,So after using above four line of code,no yellow security message would appear on screen.