# Automatic switch to the english site

**URL:** <https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298>\
**Category:** Browser\
**Created:** [6 October 2025 12:46 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298 "2025-10-06T12:46:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ouestdrancy](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ouestdrancy/32/4958_2.png) [@ouestdrancy](https://forum.robotframework.org/u/ouestdrancy)\
**Post date:** [6 October 2025 12:46 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/1 "2025-10-06T12:46:35Z")

</div>

Hello,

Recently, I’ve encountered a problem with RF. I am testing a global brand’s website which supports many languages. **I wanted to test the danish site, but it switches automatically to english after a keyword.**

How to troubleshoot this? ChatGPT could not help me to this problem.

Would be great if someone has a solution 🙂

---

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [6 October 2025 13:04 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/2 "2025-10-06T13:04:09Z")

</div>

Hello oustdrancy,

welcome to the forum.

It seems to be habit of nowadays internet that services override user choice with assumptions. The website likely tries to estimate which language you prefer. Question is what source does the website use for making the assumption that you want to view the website in English instead of Danish.

Maybe it uses the locale of the [browser context](https://marketsquare.github.io/robotframework-browser/Browser.html#New%20Context).

Try

```python
    New Context locale=da-DK

```

Kind regards,  
Markus

---

<div class="post-metadata">

**Author:** ![ouestdrancy](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ouestdrancy/32/4958_2.png) [@ouestdrancy](https://forum.robotframework.org/u/ouestdrancy)\
**Post date:** [6 October 2025 13:48 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/3 "2025-10-06T13:48:42Z")

</div>

Thank you Markus.

Unfortunately, it didn’t quite work. But I am not sure if this is the right way to use it:

```python
Setup
    [Documentation] Test Setup
    New Browser chromium headless=False
    New Context locale=da-DK
    New Page ${URL}

```

---

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [6 October 2025 13:53 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/4 "2025-10-06T13:53:55Z")

</div>

Yes this correct use of the `New` keywords. Then maybe the websites has other means to “auto-correct” the language. I am not deep enough in web-development, though. I don’t know if chrome has more settings that could be tweaked. Maybe the website uses the IP address to guess the country it is accessed from.

I don’t know, sorry.

---

<div class="post-metadata">

**Author:** ![ouestdrancy](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ouestdrancy/32/4958_2.png) [@ouestdrancy](https://forum.robotframework.org/u/ouestdrancy)\
**Post date:** [6 October 2025 13:58 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/5 "2025-10-06T13:58:36Z")

</div>

Thank you anyways 🙂

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [6 October 2025 14:52 UTC](https://forum.robotframework.org/t/automatic-switch-to-the-english-site/9298/6 "2025-10-06T14:52:52Z")

</div>

I have this old test for SeleniumLibrary, maybe you can use some info:

```python
***Settings***
Documentation \ I have a challenge
... I’m running Chrome version 67.0.3396.87. I’m running the below code; however,
... the browser does not open in the desired language (fr-ca or ja).
... https://robotframework.slack.com/messages/@U6SDCR92S
...
... Reference page:
... https://www.w3.org/International/questions/qa-lang-priorities
...
... Firefox:
... "intl": "accept_languages": "pt-PT,pt,en,en-us"
... Accept-Language: pt-PT,pt;q=0.8,en;q=0.5,en-US;q=0.3
Suite Teardown Close All Browsers
Force Tags lang_test
Task Tags teste
Library SeleniumLibrary

***Test Cases***
Set Chrome to fr-ca
    Switch language For Chrome https://www.wikipedia.org/ fr-ca
    Sleep 3 seconds
    Capture Page Screenshot
    [Teardown] Close Browser

Set Chrome to ja
    Switch language For Chrome https://www.wikipedia.org/ ja
    Sleep 3 seconds
    Capture Page Screenshot
    [Teardown] Close Browser

Set Chrome to pt-pt
    Switch language For Chrome https://www.wikipedia.org/ pt-PT
    Sleep 3 seconds
    Capture Page Screenshot
    [Teardown] Close Browser

***Keywords***
Switch language For Chrome
    [Arguments] ${url} ${locale}
    [Documentation] Starts a Chrome Browser with specified locale
    ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
    Call Method ${options} add_argument --lang\=${locale}
    Call Method ${options} add_argument user-agent\=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17
    Create webDriver Chrome chrome_options=${options}
    &{prefs}= Create Dictionary intl.accept_languages=${locale},en,en-us
    Call Method ${options} add_experimental_option prefs ${prefs}
    Create Webdriver Chrome chrome_options=${options}
    GoTo ${url}

```
