Forum Discussion

Sabiha's avatar
Sabiha
Occasional Contributor
3 years ago

Detecting and changing current browser language setting in scripts in TestComplete

Hi, 

We are currently adding localisation support for our application.  I would like to create a suite of tests to test the localisation has been implemented correctly. Currently we have 3 suites of tests that run on Edge, Firefox and Chrome.

 

I would like to be able to detect and set the language  on on each browser before running my suite of tests. Is there a way to do this?

 

I have tried the following but this is returning the system locale, not the language set on the browser.

 

aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLOCALIZEDLANGUAGENAME)
aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLOCALIZEDDISPLAYNAME);
 

Any help much appreciated, thanks.

5 Replies

    • Sabiha's avatar
      Sabiha
      Occasional Contributor

      Hi Emma,

      I am not doing anything with the language settings currently, as I haven't needed to access them up until now. I am just trying to figure out the best way to do this in a script.

       

      I have just tried the navigator.languages mentioned in the link but I am getting an error saying 'cannot read property 'language' of undefined'

       

      My test scripts are written in Javascript, is there something additional I need to do to access the navigator.language property?