Pass driver ChromeOptions and DesiredCapabilities?

0 votes

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."

I found that the temporary solution is to start web driver 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);
Aug 23, 2018 in Selenium by ghost
• 1,790 points
454 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can add ChromeOptions to DesiredCapabilities then create the driver with the DesiredCapabilities

Below 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);
answered Aug 23, 2018 by Meci Matt
• 9,400 points

Related Questions In Selenium

0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,030 points
828 views
0 votes
1 answer

Matching different browser version and selenium driver version

Look at the below link to see ...READ MORE

answered Jun 21, 2018 in Selenium by Samarpit
• 5,130 points
65 views
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
72 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
444 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
55 views
0 votes
1 answer

Setting browser width and height in Selenium Web Driver

For me, the only thing that worked ...READ MORE

answered Jul 19, 2018 in Selenium by Meci Matt
• 9,400 points
46 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.