i'm working with selenium and the chrome driver in python. I can setup the language of my chrome browser like this:
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
This works like a charm, but as soon as i add the headless argument i get results in german again:
options.add_argument("--headless")
Thank you guys for your time.
Using google-chrome-headless to set the language pass the --lang command using an instance of Options() as follows:
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--lang=en_US')
You can find a relevant detailed discussion in:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With