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
2,577 views

1 answer to this question.

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,460 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 13, 2018 in Selenium by nsv999
• 5,500 points
6,134 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,910 points
2,666 views
0 votes
1 answer
+1 vote
1 answer
0 votes
2 answers

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,500 points
13,467 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,021 views
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,910 points
7,135 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,811 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,460 points
1,120 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP