playwright-python
playwright-python copied to clipboard
[BUG] 'browser.new_context' parameter 'locale' accepts any meaningless string
async with async_playwright() as p:
browser = await p.chromium.launch()
context = await browser.new_context(locale="foO bAr Spam EGgs") # <-- NO ERROR HERE
Expected behavior
Accept only adequate Languages Codes. Raise ValueError for any non-existing code.
Another problem is that nobody knows which strings Playwright accepts.
- 'zh' ?
- 'zh-CN' ?
- 'zh_CN' ?
Ideally, a typing.Literal must be defined with a list of accepted languages' codes.