2

I am executing tests through Chrome, FF and IE. I just added IE support however some pages change their language when I browse them through IE.

I am trying to force IE to prefer English, however I don't see any matching property in InternetExplorerOptions class, additionaly there is no InternetExplorerProfile class like for Firefox.

Question: How to force IE to prefer English by Selenium or other programmatical ways?

Yoda
  • 17,363
  • 67
  • 204
  • 344

1 Answers1

0

As far as I know, Internet Explorer does not independently control its language selections. Although you can launch the Language settings app through IE 11's menus, the operating system itself controls the language.

So, I think we can't set the preferred language in selenium for IE browser. if we want to set the default Language in IE browser, we have to change it manually. Please refer to the following steps:

Open Internet Explorer, Click Tools ,Click Internet Options, Click Languages, under the General tab.

enter image description here

Then, click the Set Language Preferences. It will open the Windows setting window.

enter image description here

From within the Language Preference section, select the language you would like to have priority Click Move up repeatedly until the language is displayed at the top of the list. Then, Click OK and restart the IE browser.

Community
  • 1
  • 1
Zhi Lv
  • 18,845
  • 1
  • 19
  • 30
  • Excuse me but I was asking how to do it programmatical way, manual way doesn't solve the issue, it might work for a given machine, but I need this setting automated, that's why when I run E2E tests on Firefox I setup a profile with given capabilities. – Yoda Nov 22 '19 at 07:05
  • 1
    After testing it on my machine, it seems that IE browser language depends on the windows display language, after changing the windows display language, it need to restart the machine. So, even we could try to change the language via registry (using the programmed way), we still need to restart the Windows machine. Not sure whether it is achieving your requirement. – Zhi Lv Nov 22 '19 at 10:32
  • Besides, from your description, the web page will change the language, please check the website url, whether it contains the language setting, like this "https://learn.microsoft.com/zh-cn/dotnet/" and "https://learn.microsoft.com/en-us/dotnet/", if you are using this method, please change the website url before redirect to them. – Zhi Lv Nov 22 '19 at 10:32