Pass driver ChromeOptions and DesiredCapabilities?

0
0

The new Google chrome update causes this message in the browser “You are using an unsupported command-line flag: –ignore-certificate-errors. Stability and security will suffer.”

From what I read on selenium bug reports, the temporary solution is to start webdriver with

options.AddArgument("test-type")

I was already passing DesiredCapabilities when creating the driver. How can I pass both ChromeOptions and DesiredCapabilities to the driver?

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--incognito"));
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
WebDriver driver = new ChromeDriver(capabilities);
  • You must to post comments
0
0

I was fighting the same problem, and I finally cracked it. Basically, you can add ChromeOptions to DesiredCapabilities then create the driver with the DesiredCapabilities. Once I tried it, it got rid of the banner. Anyway, here is the code:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
capabilities.setCapability("chrome.binary", "<Path to binary>");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
webDriver = new ChromeDriver(capabilities);
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website