88name : str = 'Google Chrome/Chromium'
99
1010def run (path : str , options : OptionsDictT , start_urls : List [str ]) -> None :
11+ """
12+ Run the Chrome browser with the specified path, options, and start URLs.
13+
14+ Args:
15+ path (str): The path to the Chrome browser executable.
16+ options (OptionsDictT): A dictionary containing the options for running Chrome.
17+ start_urls (List[str]): A list of URLs to open in Chrome.
18+
19+ Raises:
20+ TypeError: If the 'cmdline_args' option is not of type List[str].
21+
22+ Returns:
23+ None
24+ """
1125 if not isinstance (options ['cmdline_args' ], list ):
1226 raise TypeError ("'cmdline_args' option must be of type List[str]" )
1327 if options ['app_mode' ]:
@@ -22,6 +36,12 @@ def run(path: str, options: OptionsDictT, start_urls: List[str]) -> None:
2236
2337
2438def find_path () -> Optional [str ]:
39+ """
40+ Finds the path of the Chrome executable based on the current operating system.
41+
42+ Returns:
43+ Optional[str]: The path of the Chrome executable if found, otherwise None.
44+ """
2545 if sys .platform in ['win32' , 'win64' ]:
2646 return _find_chrome_win ()
2747 elif sys .platform == 'darwin' :
@@ -33,6 +53,12 @@ def find_path() -> Optional[str]:
3353
3454
3555def _find_chrome_mac () -> Optional [str ]:
56+ """
57+ Find the path of Google Chrome executable on macOS.
58+
59+ Returns:
60+ Optional[str]: The path of Google Chrome executable if found, otherwise None.
61+ """
3662 default_dir = r'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
3763 if os .path .exists (default_dir ):
3864 return default_dir
@@ -45,6 +71,12 @@ def _find_chrome_mac() -> Optional[str]:
4571
4672
4773def _find_chromium_mac () -> Optional [str ]:
74+ """
75+ Find the Chromium executable path on macOS.
76+
77+ Returns:
78+ Optional[str]: The path to the Chromium executable if found, None otherwise.
79+ """
4880 default_dir = r'/Applications/Chromium.app/Contents/MacOS/Chromium'
4981 if os .path .exists (default_dir ):
5082 return default_dir
@@ -57,6 +89,12 @@ def _find_chromium_mac() -> Optional[str]:
5789
5890
5991def _find_chrome_linux () -> Optional [str ]:
92+ """
93+ Finds the path of the Chrome executable on a Linux system.
94+
95+ Returns:
96+ Optional[str]: The path of the Chrome executable if found, None otherwise.
97+ """
6098 import whichcraft as wch
6199 chrome_names = ['chromium-browser' ,
62100 'chromium' ,
@@ -71,6 +109,12 @@ def _find_chrome_linux() -> Optional[str]:
71109
72110
73111def _find_chrome_win () -> Optional [str ]:
112+ """
113+ Find the path of the Chrome executable on Windows.
114+
115+ Returns:
116+ Optional[str]: The path of the Chrome executable if found, None otherwise.
117+ """
74118 import winreg as reg
75119 reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
76120 chrome_path : Optional [str ] = None
0 commit comments