@@ -27,6 +27,7 @@ class ChromiumOptions(ArgOptions):
2727 KEY = "goog:chromeOptions"
2828
2929 def __init__ (self ) -> None :
30+ """Initialize ChromiumOptions with default settings."""
3031 super ().__init__ ()
3132 self ._binary_location : str = ""
3233 self ._extension_files : list [str ] = []
@@ -37,42 +38,49 @@ def __init__(self) -> None:
3738
3839 @property
3940 def binary_location (self ) -> str :
40- """:Returns: The location of the binary, otherwise an empty string."""
41+ """
42+ Returns:
43+ The location of the binary, otherwise an empty string.
44+ """
4145 return self ._binary_location
4246
4347 @binary_location .setter
4448 def binary_location (self , value : str ) -> None :
4549 """Allows you to set where the chromium binary lives.
4650
47- Parameters:
48- ----------
49- value: path to the Chromium binary
51+ Args:
52+ value: Path to the Chromium binary.
5053 """
5154 if not isinstance (value , str ):
5255 raise TypeError (self .BINARY_LOCATION_ERROR )
5356 self ._binary_location = value
5457
5558 @property
5659 def debugger_address (self ) -> Optional [str ]:
57- """:Returns: The address of the remote devtools instance."""
60+ """
61+ Returns:
62+ The address of the remote devtools instance.
63+ """
5864 return self ._debugger_address
5965
6066 @debugger_address .setter
6167 def debugger_address (self , value : str ) -> None :
6268 """Allows you to set the address of the remote devtools instance that
6369 the ChromeDriver instance will try to connect to during an active wait.
6470
65- Parameters:
66- ----------
67- value: address of remote devtools instance if any (hostname[:port])
71+ Args:
72+ value: Address of remote devtools instance if any (hostname[:port]).
6873 """
6974 if not isinstance (value , str ):
7075 raise TypeError ("Debugger Address must be a string" )
7176 self ._debugger_address = value
7277
7378 @property
7479 def extensions (self ) -> list [str ]:
75- """:Returns: A list of encoded extensions that will be loaded."""
80+ """
81+ Returns:
82+ A list of encoded extensions that will be loaded.
83+ """
7684
7785 def _decode (file_data : BinaryIO ) -> str :
7886 # Should not use base64.encodestring() which inserts newlines every
@@ -91,9 +99,8 @@ def add_extension(self, extension: str) -> None:
9199 """Adds the path to the extension to a list that will be used to
92100 extract it to the ChromeDriver.
93101
94- Parameters:
95- ----------
96- extension: path to the \\ *.crx file
102+ Args:
103+ extension: Path to the \\ *.crx file.
97104 """
98105 if extension :
99106 extension_to_add = os .path .abspath (os .path .expanduser (extension ))
@@ -108,9 +115,8 @@ def add_encoded_extension(self, extension: str) -> None:
108115 """Adds Base64 encoded string with extension data to a list that will
109116 be used to extract it to the ChromeDriver.
110117
111- Parameters:
112- ----------
113- extension: Base64 encoded string with extension data
118+ Args:
119+ extension: Base64 encoded string with extension data.
114120 """
115121 if extension :
116122 self ._extensions .append (extension )
@@ -119,45 +125,46 @@ def add_encoded_extension(self, extension: str) -> None:
119125
120126 @property
121127 def experimental_options (self ) -> dict :
122- """:Returns: A dictionary of experimental options for chromium."""
128+ """
129+ Returns:
130+ A dictionary of experimental options for chromium.
131+ """
123132 return self ._experimental_options
124133
125134 def add_experimental_option (self , name : str , value : Union [str , int , dict , list [str ]]) -> None :
126135 """Adds an experimental option which is passed to chromium.
127136
128- Parameters:
129- ----------
130- name: The experimental option name.
131- value: The option value.
137+ Args:
138+ name: The experimental option name.
139+ value: The option value.
132140 """
133141 self ._experimental_options [name ] = value
134142
135143 @property
136144 def enable_webextensions (self ) -> bool :
137- """:Returns: Whether webextension support is enabled for Chromium-based browsers.
138- True if webextension support is enabled, False otherwise.
145+ """
146+ Returns:
147+ Whether webextension support is enabled for Chromium-based browsers.
148+ True if webextension support is enabled, False otherwise.
139149 """
140150 return self ._enable_webextensions
141151
142152 @enable_webextensions .setter
143153 def enable_webextensions (self , value : bool ) -> None :
144154 """Enables or disables webextension support for Chromium-based browsers.
145155
146- Parameters:
147- ----------
148- value : bool
149- True to enable webextension support, False to disable.
156+ Args:
157+ value: True to enable webextension support, False to disable.
150158
151159 Notes:
152- -----
153- - When enabled, this automatically adds the required Chromium flags:
154- - --enable-unsafe-extension-debugging
155- - --remote-debugging-pipe
156- - When disabled, this removes BOTH flags listed above, even if they were manually added via add_argument()
157- before enabling webextensions.
158- - Enabling --remote-debugging-pipe makes the connection b/w chromedriver
159- and the browser use a pipe instead of a port, disabling many CDP functionalities
160- like devtools
160+ - When enabled, this automatically adds the required Chromium flags:
161+ - --enable-unsafe-extension-debugging
162+ - --remote-debugging-pipe
163+ - When disabled, this removes BOTH flags listed above, even if they were manually added via add_argument()
164+ before enabling webextensions.
165+ - Enabling --remote-debugging-pipe makes the connection b/w chromedriver
166+ and the browser use a pipe instead of a port, disabling many CDP functionalities
167+ like devtools
161168 """
162169 self ._enable_webextensions = value
163170 if value :
@@ -174,11 +181,10 @@ def enable_webextensions(self, value: bool) -> None:
174181 self ._arguments .remove (flag )
175182
176183 def to_capabilities (self ) -> dict :
177- """Creates a capabilities with all the options that have been set
184+ """Creates a capabilities with all the options that have been set.
178185
179186 Returns:
180- -------
181- dict : a dictionary with all set options
187+ A dictionary with all set options.
182188 """
183189 caps = self ._caps
184190 chrome_options = self .experimental_options .copy ()
0 commit comments