Skip to content

Commit dada4fb

Browse files
authored
[py] Fix docstring issues that sphinx complains about (#15466)
* [py] Fix docstring errors that sphinx complained about * [py] Fix parameter type for web_socket_url * [py] Remove duplicate web_socket_url from BaseOptions
1 parent 509c7f1 commit dada4fb

File tree

15 files changed

+360
-382
lines changed

15 files changed

+360
-382
lines changed

py/docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The `selenium` package is used to automate web browser interaction from Python.
1414
+-----------------+--------------------------------------------------------------------------------------+
1515
| **GitHub**: | https://github.com/SeleniumHQ/Selenium |
1616
+-----------------+--------------------------------------------------------------------------------------+
17-
| **PyPI**: | https://pypi.org/project/selenium |
17+
| **PyPI**: | https://pypi.org/project/selenium |
1818
+-----------------+--------------------------------------------------------------------------------------+
1919
| **API Docs**: | https://selenium.dev/selenium/docs/api/py/api.html |
2020
+-----------------+--------------------------------------------------------------------------------------+

py/selenium/webdriver/common/actions/action_builder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_device_with(self, name: str) -> Optional[Union["WheelInput", "PointerInp
5252
"""Get the device with the given name.
5353
5454
Parameters:
55-
----------
55+
-----------
5656
name : str
5757
The name of the device to get.
5858
@@ -86,7 +86,7 @@ def add_key_input(self, name: str) -> KeyInput:
8686
"""Add a new key input device to the action builder.
8787
8888
Parameters:
89-
----------
89+
-----------
9090
name : str
9191
The name of the key input device.
9292
@@ -107,7 +107,7 @@ def add_pointer_input(self, kind: str, name: str) -> PointerInput:
107107
"""Add a new pointer input device to the action builder.
108108
109109
Parameters:
110-
----------
110+
-----------
111111
kind : str
112112
The kind of pointer input device.
113113
- "mouse"
@@ -134,7 +134,7 @@ def add_wheel_input(self, name: str) -> WheelInput:
134134
"""Add a new wheel input device to the action builder.
135135
136136
Parameters:
137-
----------
137+
-----------
138138
name : str
139139
The name of the wheel input device.
140140
@@ -186,7 +186,7 @@ def _add_input(self, new_input: Union[KeyInput, PointerInput, WheelInput]) -> No
186186
"""Add a new input device to the action builder.
187187
188188
Parameters:
189-
----------
189+
-----------
190190
new_input : Union[KeyInput, PointerInput, WheelInput]
191191
The new input device to add.
192192
"""

py/selenium/webdriver/common/by.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class By:
6363
>>> element = driver.find_element(By.TAG_NAME, 'div')
6464
6565
CLASS_NAME:
66-
----------
66+
-----------
6767
Select the element by its class name.
6868
6969
>>> element = driver.find_element(By.CLASS_NAME, 'myElement')

py/selenium/webdriver/common/options.py

Lines changed: 73 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,19 @@ class BaseOptions(metaclass=ABCMeta):
155155
browser_version = _BaseOptionsDescriptor("browserVersion")
156156
"""Gets and Sets the version of the browser.
157157
158-
Usage
159-
-----
158+
Usage:
159+
------
160160
- Get
161161
- `self.browser_version`
162162
- Set
163163
- `self.browser_version` = `value`
164164
165-
Parameters
166-
----------
165+
Parameters:
166+
-----------
167167
`value`: `str`
168168
169-
Returns
170-
-------
169+
Returns:
170+
--------
171171
- Get
172172
- `str`
173173
- Set
@@ -177,19 +177,19 @@ class BaseOptions(metaclass=ABCMeta):
177177
platform_name = _BaseOptionsDescriptor("platformName")
178178
"""Gets and Sets name of the platform.
179179
180-
Usage
181-
-----
180+
Usage:
181+
------
182182
- Get
183183
- `self.platform_name`
184184
- Set
185185
- `self.platform_name` = `value`
186186
187-
Parameters
188-
----------
187+
Parameters:
188+
-----------
189189
`value`: `str`
190190
191-
Returns
192-
-------
191+
Returns:
192+
--------
193193
- Get
194194
- `str`
195195
- Set
@@ -199,19 +199,19 @@ class BaseOptions(metaclass=ABCMeta):
199199
accept_insecure_certs = _BaseOptionsDescriptor("acceptInsecureCerts")
200200
"""Gets and Set whether the session accepts insecure certificates.
201201
202-
Usage
203-
-----
202+
Usage:
203+
------
204204
- Get
205205
- `self.accept_insecure_certs`
206206
- Set
207207
- `self.accept_insecure_certs` = `value`
208208
209-
Parameters
210-
----------
209+
Parameters:
210+
-----------
211211
`value`: `bool`
212212
213-
Returns
214-
-------
213+
Returns:
214+
--------
215215
- Get
216216
- `bool`
217217
- Set
@@ -221,19 +221,19 @@ class BaseOptions(metaclass=ABCMeta):
221221
strict_file_interactability = _BaseOptionsDescriptor("strictFileInteractability")
222222
"""Gets and Sets whether session is about file interactability.
223223
224-
Usage
225-
-----
224+
Usage:
225+
------
226226
- Get
227227
- `self.strict_file_interactability`
228228
- Set
229229
- `self.strict_file_interactability` = `value`
230230
231-
Parameters
232-
----------
231+
Parameters:
232+
-----------
233233
`value`: `bool`
234234
235-
Returns
236-
-------
235+
Returns:
236+
--------
237237
- Get
238238
- `bool`
239239
- Set
@@ -243,19 +243,19 @@ class BaseOptions(metaclass=ABCMeta):
243243
set_window_rect = _BaseOptionsDescriptor("setWindowRect")
244244
"""Gets and Sets window size and position.
245245
246-
Usage
247-
-----
246+
Usage:
247+
------
248248
- Get
249249
- `self.set_window_rect`
250250
- Set
251251
- `self.set_window_rect` = `value`
252252
253-
Parameters
254-
----------
253+
Parameters:
254+
-----------
255255
`value`: `bool`
256256
257-
Returns
258-
-------
257+
Returns:
258+
--------
259259
- Get
260260
- `bool`
261261
- Set
@@ -265,63 +265,41 @@ class BaseOptions(metaclass=ABCMeta):
265265
enable_bidi = _BaseOptionsDescriptor("enableBidi")
266266
"""Gets and Set whether the session has WebDriverBiDi enabled.
267267
268-
Usage
269-
-----
268+
Usage:
269+
------
270270
- Get
271271
- `self.enable_bidi`
272272
- Set
273273
- `self.enable_bidi` = `value`
274274
275-
Parameters
276-
----------
275+
Parameters:
276+
-----------
277277
`value`: `bool`
278278
279-
Returns
280-
-------
279+
Returns:
280+
--------
281281
- Get
282282
- `bool`
283283
- Set
284284
- `None`
285285
"""
286286

287-
web_socket_url = _BaseOptionsDescriptor("webSocketUrl")
288-
"""Gets and Set whether the session accepts insecure certificates.
289-
290-
Usage
291-
-----
292-
- Get
293-
- `self.web_socket_url`
294-
- Set
295-
- `self.web_socket_url` = `value`
296-
297-
Parameters
298-
----------
299-
`value`: `str`
300-
301-
Returns
302-
-------
303-
- Get
304-
- `str` or `None`
305-
- Set
306-
- `None`
307-
"""
308-
309287
page_load_strategy = _PageLoadStrategyDescriptor("pageLoadStrategy")
310288
""":Gets and Sets page load strategy, the default is "normal".
311289
312-
Usage
313-
-----
290+
Usage:
291+
------
314292
- Get
315293
- `self.page_load_strategy`
316294
- Set
317295
- `self.page_load_strategy` = `value`
318296
319-
Parameters
320-
----------
297+
Parameters:
298+
-----------
321299
`value`: `str`
322300
323-
Returns
324-
-------
301+
Returns:
302+
--------
325303
- Get
326304
- `str`
327305
- Set
@@ -332,19 +310,19 @@ class BaseOptions(metaclass=ABCMeta):
332310
""":Gets and Sets unhandled prompt behavior, the default is "dismiss and
333311
notify".
334312
335-
Usage
336-
-----
313+
Usage:
314+
------
337315
- Get
338316
- `self.unhandled_prompt_behavior`
339317
- Set
340318
- `self.unhandled_prompt_behavior` = `value`
341319
342-
Parameters
343-
----------
320+
Parameters:
321+
-----------
344322
`value`: `str`
345323
346-
Returns
347-
-------
324+
Returns:
325+
--------
348326
- Get
349327
- `str`
350328
- Set
@@ -355,19 +333,19 @@ class BaseOptions(metaclass=ABCMeta):
355333
""":Gets and Sets implicit timeout, pageLoad timeout and script timeout if
356334
set (in milliseconds)
357335
358-
Usage
359-
-----
336+
Usage:
337+
------
360338
- Get
361339
- `self.timeouts`
362340
- Set
363341
- `self.timeouts` = `value`
364342
365-
Parameters
366-
----------
343+
Parameters:
344+
-----------
367345
`value`: `dict`
368346
369-
Returns
370-
-------
347+
Returns:
348+
--------
371349
- Get
372350
- `dict`
373351
- Set
@@ -377,19 +355,19 @@ class BaseOptions(metaclass=ABCMeta):
377355
proxy = _ProxyDescriptor("proxy")
378356
"""Sets and Gets Proxy.
379357
380-
Usage
381-
-----
358+
Usage:
359+
------
382360
- Get
383361
- `self.proxy`
384362
- Set
385363
- `self.proxy` = `value`
386364
387-
Parameters
388-
----------
365+
Parameters:
366+
-----------
389367
`value`: `Proxy`
390368
391-
Returns
392-
-------
369+
Returns:
370+
--------
393371
- Get
394372
- `Proxy`
395373
- Set
@@ -399,19 +377,19 @@ class BaseOptions(metaclass=ABCMeta):
399377
enable_downloads = _BaseOptionsDescriptor("se:downloadsEnabled")
400378
"""Gets and Sets whether session can download files.
401379
402-
Usage
403-
-----
380+
Usage:
381+
------
404382
- Get
405383
- `self.enable_downloads`
406384
- Set
407385
- `self.enable_downloads` = `value`
408386
409-
Parameters
410-
----------
387+
Parameters:
388+
-----------
411389
`value`: `bool`
412390
413-
Returns
414-
-------
391+
Returns:
392+
--------
415393
- Get
416394
- `bool`
417395
- Set
@@ -421,19 +399,19 @@ class BaseOptions(metaclass=ABCMeta):
421399
web_socket_url = _BaseOptionsDescriptor("webSocketUrl")
422400
"""Gets and Sets WebSocket URL.
423401
424-
Usage
425-
-----
402+
Usage:
403+
------
426404
- Get
427405
- `self.web_socket_url`
428406
- Set
429407
- `self.web_socket_url` = `value`
430408
431-
Parameters
432-
----------
433-
`value`: `bool`
409+
Parameters:
410+
-----------
411+
`value`: `str`
434412
435-
Returns
436-
-------
413+
Returns:
414+
--------
437415
- Get
438416
- `bool`
439417
- Set

0 commit comments

Comments
 (0)