Selenium Webdriver - set preferred browser language DE

前端 未结 4 1418
一生所求
一生所求 2021-01-21 19:45

I have a problem setting the preferred (accepted language) within headless Chrome using Selenium Webdriver and Ruby. I use the following WebDriver settings:

Sele         


        
4条回答
  •  一整个雨季
    2021-01-21 20:33

    I found a solution that works for me. As in many cases the problem was sitting in front of the screen and simply doesn't work precisely enough ;-)

    Instead of using

    options.add_argument("--lang=de")
    

    you have to use

    options.add_argument("--lang=de-DE")
    

    When I use an IETF language tag the code I initially posted works as expected.

提交回复
热议问题