Skip to content

Instantly share code, notes, and snippets.

@c089
Last active April 16, 2019 00:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c089/a5cbb834f9b54004de9b to your computer and use it in GitHub Desktop.
Save c089/a5cbb834f9b54004de9b to your computer and use it in GitHub Desktop.
Setting the accepted language setting using ChromeDriver (tested against ChromeDriver 2.0)
HashMap<String, String> prefs = new HashMap<String, String>();
prefs.put("intl.accept_languages", "de-DE,de");
options.setExperimentalOptions("prefs", prefs);
@BuhtigithuB
Copy link

Try to convert this into python like so :

from splinter import Browser
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('prefs', {'prefs': {'intl.accept_languages': 'en,en-US'}})
browser = Browser('chrome', options=chrome_options)

I can't get it to work, Chrome (Google) still the accpted language remain the same as define in Profil 1 Preferences file... Even more annoying is that if I change the accept_language attribute in the Preferences file, when I launch Chrome with chromedriver the orignal setting remain the same, in my case since my locales are in french it seems to keep fr as accept_languages...

Any idea??

@BuhtigithuB
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment