Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Firefox locale not available #2851

Answered by mdmintz
fredOpenscop asked this question in Q&A
Discussion options

Hello,

I'm migrating some tests to seleniumbase, and I can't launch Firefox with the correct locale.

My local Firefox is in French, but the one start for the test is in English, and don't have any other language available.

Here is a part of the about:config page that is of interest :

Application Settings
Requested Locales: ["fr-FR"]
Available Locales: ["en-US"]
App Locales: ["en-US"]
Regional Preferences: ["en-US"]
Default Locale: "en-US"
Operating System
System Locales: ["fr-FR"]
Regional Preferences: ["fr-FR"]

As you can see, it correctly takes the fr locale that I request, but the automated Firefox don't have it. Is there something to do to make it available ?

Thanks for the help.

You must be logged in to vote

After running this:

pytest --firefox --locale="fr"

Sites visited became French in Firefox:

If that isn't working for you, then I'm not sure what else is happening on your end.

Valid local codes: SeleniumBase/help_docs/locale_codes.md

For the SB() and Driver() formats, use locale_code, eg: SB(locale_code="fr")

Replies: 3 comments 3 replies

Comment options

There's a section on changing locale here:
https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md

For the SB() and Driver() formats, use locale_code, eg: SB(locale_code="fr")

You must be logged in to vote
3 replies
Comment options

Yeah, I did that and that didn't change anything :/

the locale is correctly set to the one I ask for using --locale=fr, it's just that it is not available on the Firefox used for the test, but the Firefox I use every day have it :/

it seems that sb use another Firefox instance or something that don't have the language :/

Comment options

Do you have multiple versions of Firefox installed? SeleniumBase will first try to use the one in the default location. If it can't find it, then Selenium Manager will try to download a new Firefox into the ~/.cache/selenium folder. If you see one there, then it did.

Comment options

No, I did uninstall every Firefox binary I found and check that the test didn't launch before reinstalling Firefox.

Still the same issue when I launch it manually it is in fr when pytest launch it, it is in en without fr available

Only chromedriver in the .cache/selenium folder (no issue with chronium, correctly set to fr locale), I did remove everything in any case.

Comment options

After running this:

pytest --firefox --locale="fr"

Sites visited became French in Firefox:

Screenshot 2024年06月12日 at 10 20 56 AM

If that isn't working for you, then I'm not sure what else is happening on your end.

Valid local codes: SeleniumBase/help_docs/locale_codes.md

For the SB() and Driver() formats, use locale_code, eg: SB(locale_code="fr")

You must be logged in to vote
0 replies
Answer selected by mdmintz
Comment options

Also SB(UC=True, locale_code="tr") is not working on my arm Linux device. Everything is up to date. No matter what I set as locale_code, websites automatically request it in my system language.
On selenium, I was using
options.add_experimental_option('prefs', {'intl.accept_languages':'tr'})
but I can't use this with SB.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /