user2132167
user2132167

Reputation: 151

Changing Chrome's settings with Selenium

I'm working on Chrome with Selenium and I'm looking to change a few settings within Chrome using the webdriver. Using Google and this site, I was able to get most of the settings working. However, a few more seem to escape me and hopefully I can get the answers here. I'm looking to alter the settings before launching the browser, such as using ChromeOptions, rather than using automation to navigate the settings page.

The settings I'm looking to change are as follows:

These 4 are giving me the most issues. Any help?

Upvotes: 0

Views: 9786

Answers (1)

MikeJRamsey56
MikeJRamsey56

Reputation: 2819

Perhaps this List of Chromium Command Line Switches will help. E.g.

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.switches", Arrays.asList("--disable-javascript"));

And

Map<String, Object> preferences = Maps.newHashMap();
preferences.put( "browser.startup.homepage", "http://my.home.page" );
preferences.put( "browser.startup.page", START_WITH_HOME_PAGE );
capabilities.setCapability( ChromeOptions.CAPABILITY, preferences );
ChromeDriver driver = new ChromeDriver( capabilities );

Update

My guess is that the following

"import_search_engine": true

from Configuring other parameters will cause Chrome to ask you to select a search engine when it opens.

Turning off JavaScript makes chrome pretty much a no-op; I do not think that the option is supported. As far as microphones, that is more a system option. A search of about:config for microphone came up empty.

Upvotes: 1

Related Questions