66import sys
77import tempfile
88import zipfile
9- from typing import Any , List , Optional , Union
9+ from typing import Any , List , Literal , Optional , Union
1010
1111__all__ = [
1212 "Config" ,
2323PathLike = Union [str , pathlib .Path ]
2424AUTO = None
2525
26+ BrowserType = Literal ["chrome" , "brave" , "auto" ]
27+
2628
2729class Config :
2830 """
@@ -34,7 +36,7 @@ def __init__(
3436 user_data_dir : Optional [PathLike ] = AUTO ,
3537 headless : Optional [bool ] = False ,
3638 browser_executable_path : Optional [PathLike ] = AUTO ,
37- browser : str = "auto" ,
39+ browser : BrowserType = "auto" ,
3840 browser_args : Optional [List [str ]] = AUTO ,
3941 sandbox : Optional [bool ] = True ,
4042 lang : Optional [str ] = None ,
@@ -75,7 +77,7 @@ def __init__(
7577 :type user_data_dir: PathLike
7678 :type headless: bool
7779 :type browser_executable_path: PathLike
78- :type browser: str
80+ :type browser: BrowserType
7981 :type browser_args: list[str]
8082 :type sandbox: bool
8183 :type lang: str
@@ -306,7 +308,7 @@ def find_binary(candidates):
306308 return winner
307309
308310
309- def find_executable (browser : str = "auto" ) -> PathLike :
311+ def find_executable (browser : BrowserType = "auto" ) -> PathLike :
310312 """
311313 Finds the executable for the specified browser and returns its disk path.
312314 :param browser: The browser to find. Can be "chrome", "brave" or "auto".
0 commit comments