5

I am using the ChromeDriver with java and the arquillian drone Framework to test the localization of our webpage. To test the behavior on unsupported locales set in the browser we set the chromes locale via the command line argument:

--lang=it

The resulting ACCEPT-LANGUAGE-header, however, looks like this:

it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4

Is there a way to keep the chromeDriver from automatically allowing en_us and en?

Abaddon666
  • 1,533
  • 15
  • 31
  • Hi, you don't specify which language you use to launch you chromedriver instance – Richard Apr 28 '17 at 03:54
  • I added the Information – Abaddon666 Apr 28 '17 at 07:52
  • I see the new tag... You could had mention it in the question title or the core question... But great question improvment... I will retrieve another question and gist... As I consider now you question as duplicate from another one... Give me a minute. – Richard Apr 28 '17 at 19:53
  • The other question I mention was the one I specify in my answer in the first place had hard time to retrieved it as I was searching for another question... haha... – Richard Apr 28 '17 at 20:20

1 Answers1

2

If you use Python to lauch your chromedriver instance you may consider this gist :

https://gist.github.com/BuhtigithuB/11df8cf8d03bb236985156de204fe7b4

And my answer here :

WebDriver: How to specify preferred languages for Chrome


UPDATE

Since you specify JAVA here a gist that suppose to work for JAVA :

https://gist.github.com/c089/a5cbb834f9b54004de9b

Community
  • 1
  • 1
Richard
  • 721
  • 5
  • 16
  • I was under the impression this Argument is no longer supported by the current webdriver – Abaddon666 Apr 28 '17 at 07:53
  • 1
    My examples are working with the last chrome/chromedriver selenium/splinter version... To me, it the best way to control language of page loading as accept_language is a browser configuration specification and it makes hardly sens to have to go back at the OS command line to specify the browser configuration or the locale the chrome instance should use... At least, it makes the way of passing the accept_languages to chromedriver more the same as how it used to be with geckodriver (firefox driver)... Good luck! – Richard Apr 28 '17 at 20:18
  • Thanks a lot! I really thought this was already deprecated or only working for firefox. Passing it via experimental option actually did the trick! – Abaddon666 May 02 '17 at 08:55