Add a method for getting the browser's Locale Code
- Add method:
self.get_locale_code()
- Add language translations for
self.get_locale_code()
- Add examples for testing the browser's Locale Code
To set the browser's Locale Code for tests, add the following to your pytest run command:
--locale=LOCALE_CODE
Example: (from the examples/
folder)
$ pytest locale_code_test.py --locale=he-IL
To determine your browser's default Locale Code, here's a test that you can run: (from the examples/
folder)
$ pytest test_get_locale_code.py
============================= test session starts ===============================
platform darwin -- Python 3.7.0, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /Users/michael/github/SeleniumBase, configfile: pytest.ini
plugins: xdist-2.0.0, html-2.0.1, rerunfailures-9.0, metadata-1.10.0,
allure-pytest-2.8.18, ordering-0.6, cov-2.10.1, forked-1.3.0, seleniumbase-1.47.3
collected 1 item
test_get_locale_code.py
Locale Code = "en-US"
.
============================== 1 passed in 7.45s ================================
Here's a reminder that pytest
can be run in Quiet Mode with -q
to reduce debug statements:
$ pytest test_get_locale_code.py -q
Locale Code = "en-US"
.
1 passed in 7.18s