[Python] Selenium change language browser Chrome / Firefox

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to test my website with Selenium but I don't manage to change the language of the browser. I tried with Firefox, changing the profile also but it's not working.

    That's a pity because much of my content is changing regarding the language.

    Here is my Python code:

    @classmethod
    def setUpClass(cls):
    super(SeleniumTestCase, cls).setUpClass()
    options = Options()
    options.add_argument('--lang=en')
    cls.selenium = WebDriver(chrome_options=options)


    So normally I change the language but nothing happens...

    Just to clarify. I already checked on stackoverflow and if I post this question it's really because I tried most of the solutions I saw.

    Continue reading...

Compartilhe esta Página