Below is the error while run in chrome.
![alt text](http://findnerd.s3.amazonaws.com/imagedata/3072/3072.jpeg)
Use this code, it will always work
System.setProperty("webdriver.chrome.driver", YourChromePath);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
capabilities.setCapability("chrome.binary", YourChromePath);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Explanation of above code
ChromeDriver() Use default host server configuration it creates a new chrome driver
To resolve this above issue we use DesiredCapabilities and ChromeOptions.
DesiredCapabilities gives you an options to customize and configure a browser session, here it customize chrome with the help of "chrome.binary" and ChromeOptions creates a new ChromeDriver instance with chrome "test-type" options instead of default host server configuration.
To disable "unsupported command-line flags", we have to add Chrome argument "test-type"
Later, with the help of Key "CAPABILITY" we store a set of ChromeOptions in a DesiredCapabilities object.
0 Comment(s)