I\'m trying to test my website with selenium but I don\'t manage to change the language of the browser. I tried with firefox, changing the profile also but it\'s not working.
The answer is already available in one of the very recent post:
Change language on Firefox with Selenium Python
Here is the code:
def get_webdriver(attempts=3, timeout=60, locale='en-us'):
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("intl.accept_languages", locale)
firefox_profile.update_preferences()
desired_capabilities = getattr(
DesiredCapabilities, "FIREFOX").copy()
hub_url = urljoin('http://hub:4444', '/wd/hub')
driver = webdriver.Remote(
command_executor=hub_url, desired_capabilities=desired_capabilities,
browser_profile=firefox_profile)
return driver