question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow setting the browser language

See original GitHub issue

Is your feature request related to a problem? Please describe.

Our application behaves differently according to the language of the browser. Currently, we have no way of influencing the language.

Describe the solution you’d like

Ideally, it would be possible to set environment variables when starting an element test in the cloud which are then consumed by the browser. Also effectively setting the browser language in elements would be a solution (either using the TestSettings or the browser interface).

Describe alternatives you’ve considered

Methods I tried:

  • setting parameters for chromium using --lang= doesn’t work due to restrictions of chromium itself
  • setting of environment variables is not supported when running in the cloud

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sonnguyenmaucommented, Oct 12, 2020

Hi @torfmaster,

The --lang launchArg doesn’t work due to a bug of Puppeteer. However, as @honglax suggested, you can set the browser language by using extraHTTPHeaders in the TestSettings. In my case, this is what I used:

export const settings: TestSettings = {

	extraHTTPHeaders: { 'Accept-Language': 'bn' }
}

and this is the screenshot that I got when running the test on Flood (cloud), targeting Google. You can see that the language has been set to Bangla (Bangladesh)

image

Please try it out and let us know if you still have any problems.

1reaction
honglaxcommented, Oct 12, 2020

Hi @torfmaster

Have you ever tried extraHTTPHeaders: {'Accept-Language': 'en, fr, vi'} with TestSettings like this image below?

element-set-language

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting language preferences in a browser - W3C
Chrome. Open the browser settings, and in the advanced section scroll down to find Languages . Open Language and Input Settings and add...
Read more >
How to Change the Default Language of an Internet Browser.
On the right side of the Settings window, scroll down to the Languages section and click the Language option. Language option in Opera...
Read more >
How to change the locale in chrome browser - Stack Overflow
Open chrome, go to chrome://settings/languages. On the left, you should see a list of languages. Use mouse to drag the language you want...
Read more >
Change language in Chrome: step-by-step guide - IONOS
Quick overview: changing the Chrome browser language · Open the menu item “Settings.” · Expand the displayed settings and scroll down to the...
Read more >
How to change the language in the Google Chrome browser
Run Google Chrome. · Click the three-dot icon beside your profile icon. · In the drop-down menu, select Settings. · In the left...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found