How to modify the website language using selenium python bindings.


How can I modify the language option in selenium python bindings?

I’ve tried the — lang, but it didn’t work for me:

Not Working:


After some research, I found that to solve this, we have to use the experimental option intl.accept_languages:

Working Solution:

options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
driver = webdriver.Chrome(chrome_options=options)

Note: To use above, your website should need to support the same.

There is one more way to achieve the same by translating your native language page to english:

Try using below code:

prefs = {
"translate_whitelists": {"your native language":"en"},
options.add_experimental_option("prefs", prefs)