Selenium Webdriver - set preferred browser language DE

前端 未结 4 1471
一生所求
一生所求 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:28

    You should be able to solve your problem by adding an experimental option:

    options.add_option('prefs', {'intl.accept_languages': 'en,en_US'})
    

    I'm sure it works with Python, but I've not tried with Ruby: this approach is the correct one, not sure about the implementation.
    You can find in this repository the code which handles your problem in Python code, and in this Q&A how to implement experimental_options in Ruby

提交回复
热议问题