0 votes
1 view
in Devops and Agile by (25k points)

The Selenium documentation mentions that the Chrome web driver can take an instance of  ChromeOptions., but I can't figure out how to create  ChromeOptions.

I'm hoping to pass the   --disable-extensions  flag to Chrome.

1 Answer

0 votes
by (63.3k points)

You can create an instance of ChromeOptions, which has convenient methods for setting ChromeDriver-specific capabilities. You can then pass the ChromeOptions object into the ChromeDriver constructor:

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);  

Hope this helps!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...