diff --git a/py/selenium/webdriver/common/action_chains.py b/py/selenium/webdriver/common/action_chains.py
index 994bf70867813..6a3a4b37777ba 100644
--- a/py/selenium/webdriver/common/action_chains.py
+++ b/py/selenium/webdriver/common/action_chains.py
@@ -69,9 +69,9 @@ class ActionChains:
def __init__(self, driver: WebDriver, duration: int = 250, devices: list[AnyDevice] | None = None) -> None:
"""Creates a new ActionChains.
- :Args:
- - driver: The WebDriver instance which performs user actions.
- - duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in PointerInput
+ Args:
+ driver: The WebDriver instance which performs user actions.
+ duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in PointerInput
"""
self._driver = driver
mouse = None
@@ -101,9 +101,9 @@ def reset_actions(self) -> None:
def click(self, on_element: WebElement | None = None) -> ActionChains:
"""Clicks an element.
- :Args:
- - on_element: The element to click.
- If None, clicks on current mouse position.
+ Args:
+ on_element: The element to click.
+ If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
@@ -117,9 +117,9 @@ def click(self, on_element: WebElement | None = None) -> ActionChains:
def click_and_hold(self, on_element: WebElement | None = None) -> ActionChains:
"""Holds down the left mouse button on an element.
- :Args:
- - on_element: The element to mouse down.
- If None, clicks on current mouse position.
+ Args:
+ on_element: The element to mouse down.
+ If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
@@ -132,9 +132,9 @@ def click_and_hold(self, on_element: WebElement | None = None) -> ActionChains:
def context_click(self, on_element: WebElement | None = None) -> ActionChains:
"""Performs a context-click (right click) on an element.
- :Args:
- - on_element: The element to context-click.
- If None, clicks on current mouse position.
+ Args:
+ on_element: The element to context-click.
+ If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
@@ -148,9 +148,9 @@ def context_click(self, on_element: WebElement | None = None) -> ActionChains:
def double_click(self, on_element: WebElement | None = None) -> ActionChains:
"""Double-clicks an element.
- :Args:
- - on_element: The element to double-click.
- If None, clicks on current mouse position.
+ Args:
+ on_element: The element to double-click.
+ If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
@@ -165,9 +165,9 @@ def drag_and_drop(self, source: WebElement, target: WebElement) -> ActionChains:
"""Holds down the left mouse button on the source element, then moves
to the target element and releases the mouse button.
- :Args:
- - source: The element to mouse down.
- - target: The element to mouse up.
+ Args:
+ source: The element to mouse down.
+ target: The element to mouse up.
"""
self.click_and_hold(source)
self.release(target)
@@ -177,10 +177,10 @@ def drag_and_drop_by_offset(self, source: WebElement, xoffset: int, yoffset: int
"""Holds down the left mouse button on the source element, then moves
to the target offset and releases the mouse button.
- :Args:
- - source: The element to mouse down.
- - xoffset: X offset to move to.
- - yoffset: Y offset to move to.
+ Args:
+ source: The element to mouse down.
+ xoffset: X offset to move to.
+ yoffset: Y offset to move to.
"""
self.click_and_hold(source)
self.move_by_offset(xoffset, yoffset)
@@ -191,10 +191,10 @@ def key_down(self, value: str, element: WebElement | None = None) -> ActionChain
"""Sends a key press only, without releasing it. Should only be used
with modifier keys (Control, Alt and Shift).
- :Args:
- - value: The modifier key to send. Values are defined in `Keys` class.
- - element: The element to send keys.
- If None, sends a key to current focused element.
+ Args:
+ value: The modifier key to send. Values are defined in `Keys` class.
+ element: The element to send keys.
+ If None, sends a key to current focused element.
Example, pressing ctrl+c::
@@ -211,10 +211,10 @@ def key_down(self, value: str, element: WebElement | None = None) -> ActionChain
def key_up(self, value: str, element: WebElement | None = None) -> ActionChains:
"""Releases a modifier key.
- :Args:
- - value: The modifier key to send. Values are defined in Keys class.
- - element: The element to send keys.
- If None, sends a key to current focused element.
+ Args:
+ value: The modifier key to send. Values are defined in Keys class.
+ element: The element to send keys.
+ If None, sends a key to current focused element.
Example, pressing ctrl+c::
@@ -231,9 +231,9 @@ def key_up(self, value: str, element: WebElement | None = None) -> ActionChains:
def move_by_offset(self, xoffset: int, yoffset: int) -> ActionChains:
"""Moving the mouse to an offset from current mouse position.
- :Args:
- - xoffset: X offset to move to, as a positive or negative integer.
- - yoffset: Y offset to move to, as a positive or negative integer.
+ Args:
+ xoffset: X offset to move to, as a positive or negative integer.
+ yoffset: Y offset to move to, as a positive or negative integer.
"""
self.w3c_actions.pointer_action.move_by(xoffset, yoffset)
@@ -244,8 +244,8 @@ def move_by_offset(self, xoffset: int, yoffset: int) -> ActionChains:
def move_to_element(self, to_element: WebElement) -> ActionChains:
"""Moving the mouse to the middle of an element.
- :Args:
- - to_element: The WebElement to move to.
+ Args:
+ to_element: The WebElement to move to.
"""
self.w3c_actions.pointer_action.move_to(to_element)
@@ -257,10 +257,10 @@ def move_to_element_with_offset(self, to_element: WebElement, xoffset: int, yoff
"""Move the mouse by an offset of the specified element. Offsets are
relative to the in-view center point of the element.
- :Args:
- - to_element: The WebElement to move to.
- - xoffset: X offset to move to, as a positive or negative integer.
- - yoffset: Y offset to move to, as a positive or negative integer.
+ Args:
+ to_element: The WebElement to move to.
+ xoffset: X offset to move to, as a positive or negative integer.
+ yoffset: Y offset to move to, as a positive or negative integer.
"""
self.w3c_actions.pointer_action.move_to(to_element, int(xoffset), int(yoffset))
@@ -279,9 +279,9 @@ def pause(self, seconds: float | int) -> ActionChains:
def release(self, on_element: WebElement | None = None) -> ActionChains:
"""Releasing a held mouse button on an element.
- :Args:
- - on_element: The element to mouse up.
- If None, releases on current mouse position.
+ Args:
+ on_element: The element to mouse up.
+ If None, releases on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
@@ -294,9 +294,9 @@ def release(self, on_element: WebElement | None = None) -> ActionChains:
def send_keys(self, *keys_to_send: str) -> ActionChains:
"""Sends keys to current focused element.
- :Args:
- - keys_to_send: The keys to send. Modifier keys constants can be found in the
- 'Keys' class.
+ Args:
+ keys_to_send: The keys to send. Modifier keys constants can be found in the
+ 'Keys' class.
"""
typing = keys_to_typing(keys_to_send)
@@ -309,10 +309,10 @@ def send_keys(self, *keys_to_send: str) -> ActionChains:
def send_keys_to_element(self, element: WebElement, *keys_to_send: str) -> ActionChains:
"""Sends keys to an element.
- :Args:
- - element: The element to send keys.
- - keys_to_send: The keys to send. Modifier keys constants can be found in the
- 'Keys' class.
+ Args:
+ element: The element to send keys.
+ keys_to_send: The keys to send. Modifier keys constants can be found in the
+ 'Keys' class.
"""
self.click(element)
self.send_keys(*keys_to_send)
@@ -322,8 +322,8 @@ def scroll_to_element(self, element: WebElement) -> ActionChains:
"""If the element is outside the viewport, scrolls the bottom of the
element to the bottom of the viewport.
- :Args:
- - element: Which element to scroll into the viewport.
+ Args:
+ element: Which element to scroll into the viewport.
"""
self.w3c_actions.wheel_action.scroll(origin=element)
@@ -333,9 +333,9 @@ def scroll_by_amount(self, delta_x: int, delta_y: int) -> ActionChains:
"""Scrolls by provided amounts with the origin in the top left corner
of the viewport.
- :Args:
- - delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
- - delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
+ Args:
+ delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
+ delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
"""
self.w3c_actions.wheel_action.scroll(delta_x=delta_x, delta_y=delta_y)
@@ -348,13 +348,13 @@ def scroll_from_origin(self, scroll_origin: ScrollOrigin, delta_x: int, delta_y:
is not in the viewport, the bottom of the element will first be
scrolled to the bottom of the viewport.
- :Args:
- - origin: Where scroll originates (viewport or element center) plus provided offsets.
- - delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
- - delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
+ Args:
+ scroll_origin: Where scroll originates (viewport or element center) plus provided offsets.
+ delta_x: Distance along X axis to scroll using the wheel. A negative value scrolls left.
+ delta_y: Distance along Y axis to scroll using the wheel. A negative value scrolls up.
- :Raises: If the origin with offset is outside the viewport.
- - MoveTargetOutOfBoundsException - If the origin with offset is outside the viewport.
+ Raises:
+ MoveTargetOutOfBoundsException: If the origin with offset is outside the viewport.
"""
if not isinstance(scroll_origin, ScrollOrigin):
diff --git a/py/selenium/webdriver/common/alert.py b/py/selenium/webdriver/common/alert.py
index ef26de858def1..11556bf0d0485 100644
--- a/py/selenium/webdriver/common/alert.py
+++ b/py/selenium/webdriver/common/alert.py
@@ -47,8 +47,8 @@ class Alert:
def __init__(self, driver) -> None:
"""Creates a new Alert.
- :Args:
- - driver: The WebDriver instance which performs user actions.
+ Args:
+ driver: The WebDriver instance which performs user actions.
"""
self.driver = driver
@@ -64,17 +64,15 @@ def dismiss(self) -> None:
def accept(self) -> None:
"""Accepts the alert available.
- :Usage:
- ::
-
- Alert(driver).accept() # Confirm a alert dialog.
+ Example:
+ Alert(driver).accept() # Confirm a alert dialog.
"""
self.driver.execute(Command.W3C_ACCEPT_ALERT)
def send_keys(self, keysToSend: str) -> None:
"""Send Keys to the Alert.
- :Args:
- - keysToSend: The text to be sent to Alert.
+ Args:
+ keysToSend: The text to be sent to Alert.
"""
self.driver.execute(Command.W3C_SET_ALERT_VALUE, {"value": keys_to_typing(keysToSend), "text": keysToSend})
diff --git a/py/selenium/webdriver/common/log.py b/py/selenium/webdriver/common/log.py
index 8e041006dd912..ba892a43231a9 100644
--- a/py/selenium/webdriver/common/log.py
+++ b/py/selenium/webdriver/common/log.py
@@ -57,9 +57,7 @@ def __init__(self, driver, bidi_session) -> None:
async def mutation_events(self) -> AsyncGenerator[dict[str, Any], None]:
"""Listen for mutation events and emit them as they are found.
- :Usage:
- ::
-
+ Example:
async with driver.log.mutation_events() as event:
pages.load("dynamic.html")
driver.find_element(By.ID, "reveal").click()
@@ -101,9 +99,7 @@ async def add_js_error_listener(self) -> AsyncGenerator[dict[str, Any], None]:
"""Listen for JS errors and when the contextmanager exits check if
there were JS Errors.
- :Usage:
- ::
-
+ Example:
async with driver.log.add_js_error_listener() as error:
driver.find_element(By.ID, "throwing-mouseover").click()
assert bool(error)
@@ -124,12 +120,10 @@ async def add_js_error_listener(self) -> AsyncGenerator[dict[str, Any], None]:
async def add_listener(self, event_type) -> AsyncGenerator[dict[str, Any], None]:
"""Listen for certain events that are passed in.
- :Args:
- - event_type: The type of event that we want to look at.
-
- :Usage:
- ::
+ Args:
+ event_type: The type of event that we want to look at.
+ Example:
async with driver.log.add_listener(Console.log) as messages:
driver.execute_script("console.log('I like cheese')")
assert messages["message"] == "I love cheese"
diff --git a/py/selenium/webdriver/common/proxy.py b/py/selenium/webdriver/common/proxy.py
index f14c201542abc..b45d35432065a 100644
--- a/py/selenium/webdriver/common/proxy.py
+++ b/py/selenium/webdriver/common/proxy.py
@@ -97,161 +97,41 @@ class Proxy:
# create descriptor type objects
auto_detect = _ProxyTypeDescriptor("autodetect", ProxyType.AUTODETECT)
- """Gets and Sets `auto_detect`
-
- Usage:
- ------
- - Get
- - `self.auto_detect`
- - Set
- - `self.auto_detect` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """Proxy autodetection setting (boolean)."""
# TODO: Remove ftpProxy in future version and remove deprecation warning
ftp_proxy = _ProxyTypeDescriptor("ftpProxy", ProxyType.MANUAL)
- """Gets and Sets `ftp_proxy`
-
- Usage:
- ------
- - Get
- - `self.ftp_proxy`
- - Set
- - `self.ftp_proxy` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """FTP proxy address (deprecated)."""
http_proxy = _ProxyTypeDescriptor("httpProxy", ProxyType.MANUAL)
- """Gets and Sets `http_proxy`
-
- Usage:
- ------
- - Get
- - `self.http_proxy`
- - Set
- - `self.http_proxy` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """HTTP proxy address."""
no_proxy = _ProxyTypeDescriptor("noProxy", ProxyType.MANUAL)
- """Gets and Sets `no_proxy`
-
- Usage:
- ------
- - Get
- - `self.no_proxy`
- - Set
- - `self.no_proxy` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """Addresses to bypass proxy."""
proxy_autoconfig_url = _ProxyTypeDescriptor("proxyAutoconfigUrl", ProxyType.PAC)
- """Gets and Sets `proxy_autoconfig_url`
-
- Usage:
- ------
- - Get
- - `self.proxy_autoconfig_url`
- - Set
- - `self.proxy_autoconfig_url` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """Proxy autoconfiguration URL."""
ssl_proxy = _ProxyTypeDescriptor("sslProxy", ProxyType.MANUAL)
- """Gets and Sets `ssl_proxy`
-
- Usage:
- ------
- - Get
- - `self.ssl_proxy`
- - Set
- - `self.ssl_proxy` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """SSL proxy address."""
socks_proxy = _ProxyTypeDescriptor("socksProxy", ProxyType.MANUAL)
- """Gets and Sets `socks_proxy`
-
- Usage:
- ------
- - Get
- - `self.sock_proxy`
- - Set
- - `self.socks_proxy` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """SOCKS proxy address."""
socks_username = _ProxyTypeDescriptor("socksUsername", ProxyType.MANUAL)
- """Gets and Sets `socks_password`
-
- Usage:
- ------
- - Get
- - `self.socks_password`
- - Set
- - `self.socks_password` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """SOCKS proxy username."""
socks_password = _ProxyTypeDescriptor("socksPassword", ProxyType.MANUAL)
- """Gets and Sets `socks_password`
-
- Usage:
- ------
- - Get
- - `self.socks_password`
- - Set
- - `self.socks_password` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """SOCKS proxy password."""
socks_version = _ProxyTypeDescriptor("socksVersion", ProxyType.MANUAL)
- """Gets and Sets `socks_version`
-
- Usage:
- ------
- - Get
- - `self.socks_version`
- - Set
- - `self.socks_version` = `value`
-
- Parameters:
- -----------
- `value`: `str`
- """
+ """SOCKS proxy version."""
def __init__(self, raw=None):
"""Creates a new Proxy.
- :Args:
- - raw: raw proxy data. If None, default class values are used.
+ Args:
+ raw: Raw proxy data. If None, default class values are used.
"""
if raw:
if "proxyType" in raw and raw["proxyType"]:
@@ -293,8 +173,8 @@ def proxy_type(self):
def proxy_type(self, value) -> None:
"""Sets proxy type.
- :Args:
- - value: The proxy type.
+ Args:
+ value: The proxy type.
"""
self._verify_proxy_type_compatibility(value)
self.proxyType = value
@@ -326,12 +206,11 @@ def to_capabilities(self):
proxy_caps[proxy] = attr_value
return proxy_caps
- def to_bidi_dict(self):
+ def to_bidi_dict(self) -> dict:
"""Convert proxy settings to BiDi format.
Returns:
- -------
- dict: Proxy configuration in BiDi format.
+ Proxy configuration in BiDi format.
"""
proxy_type = self.proxyType["string"].lower()
result = {"proxyType": proxy_type}
diff --git a/py/selenium/webdriver/common/selenium_manager.py b/py/selenium/webdriver/common/selenium_manager.py
index 9caec37e10c7f..125b4b3459fc0 100644
--- a/py/selenium/webdriver/common/selenium_manager.py
+++ b/py/selenium/webdriver/common/selenium_manager.py
@@ -38,9 +38,11 @@ class SeleniumManager:
def binary_paths(self, args: list) -> dict:
"""Determines the locations of the requested assets.
- :Args:
- - args: the commands to send to the selenium manager binary.
- :Returns: dictionary of assets and their path
+ Args:
+ args: the commands to send to the selenium manager binary.
+
+ Returns:
+ Dictionary of assets and their path.
"""
args = [str(self._get_binary())] + args
@@ -57,9 +59,11 @@ def binary_paths(self, args: list) -> dict:
def _get_binary() -> Path:
"""Determines the path of the correct Selenium Manager binary.
- :Returns: The Selenium Manager executable location
+ Returns:
+ The Selenium Manager executable location.
- :Raises: WebDriverException if the platform is unsupported
+ Raises:
+ WebDriverException: If the platform is unsupported.
"""
compiled_path = Path(__file__).parent.joinpath("selenium-manager")
@@ -105,9 +109,11 @@ def _get_binary() -> Path:
def _run(args: list[str]) -> dict:
"""Executes the Selenium Manager Binary.
- :Args:
- - args: the components of the command being executed.
- :Returns: The log string containing the driver location.
+ Args:
+ args: the components of the command being executed.
+
+ Returns:
+ The log string containing the driver location.
"""
command = " ".join(args)
logger.debug("Executing process: %s", command)
diff --git a/py/selenium/webdriver/common/timeouts.py b/py/selenium/webdriver/common/timeouts.py
index d10704557f8b2..008aef36ce8e6 100644
--- a/py/selenium/webdriver/common/timeouts.py
+++ b/py/selenium/webdriver/common/timeouts.py
@@ -54,16 +54,13 @@ def __init__(self, implicit_wait: float = 0, page_load: float = 0, script: float
This implements https://w3c.github.io/webdriver/#timeouts.
- :Args:
- - implicit_wait - Either an int or a float. Set how many
- seconds to wait when searching for elements before
- throwing an error.
- - page_load - Either an int or a float. Set how many seconds
- to wait for a page load to complete before throwing
- an error.
- - script - Either an int or a float. Set how many seconds to
- wait for an asynchronous script to finish execution
- before throwing an error.
+ Args:
+ implicit_wait: Number of seconds to wait when searching for elements
+ before throwing an error.
+ page_load: Number of seconds to wait for a page load to complete
+ before throwing an error.
+ script: Number of seconds to wait for an asynchronous script to
+ finish execution before throwing an error.
"""
self._implicit_wait = self._convert(implicit_wait)
@@ -72,55 +69,21 @@ def __init__(self, implicit_wait: float = 0, page_load: float = 0, script: float
# Creating descriptor objects
implicit_wait = _TimeoutsDescriptor("_implicit_wait")
- """Get or set how many seconds to wait when searching for elements.
+ """Number of seconds to wait when searching for elements.
- This does not set the value on the remote end.
-
- Usage:
- ------
- - Get
- - `self.implicit_wait`
- - Set
- - `self.implicit_wait` = `value`
-
- Parameters:
- -----------
- `value`: `float`
+ Note: This does not set the value on the remote end.
"""
page_load = _TimeoutsDescriptor("_page_load")
- """Get or set how many seconds to wait for the page to load.
-
- This does not set the value on the remote end.
+ """Number of seconds to wait for the page to load.
- Usage:
- ------
- - Get
- - `self.page_load`
- - Set
- - `self.page_load` = `value`
-
- Parameters:
- -----------
- `value`: `float`
+ Note: This does not set the value on the remote end.
"""
script = _TimeoutsDescriptor("_script")
- """Get or set how many seconds to wait for an asynchronous script to finish
- execution.
-
- This does not set the value on the remote end.
-
- Usage:
- ------
- - Get
- - `self.script`
- - Set
- - `self.script` = `value`
+ """Number of seconds to wait for an asynchronous script to finish execution.
- Parameters:
- -----------
- `value`: `float`
+ Note: This does not set the value on the remote end.
"""
def _convert(self, timeout: float) -> int:
diff --git a/py/selenium/webdriver/common/utils.py b/py/selenium/webdriver/common/utils.py
index fd5ac0b0607f2..fac1b4b475477 100644
--- a/py/selenium/webdriver/common/utils.py
+++ b/py/selenium/webdriver/common/utils.py
@@ -68,11 +68,11 @@ def find_connectable_ip(host: Union[str, bytes, bytearray, None], port: Optional
If the optional port number is provided, only IPs that listen on the given
port are considered.
- :Args:
- - host - hostname
- - port - port number
+ Args:
+ host: hostname
+ port: port number
- :Returns:
+ Returns:
A single IP address, as a string. If any IPv4 address is found, one is
returned. Otherwise, if any IPv6 address is found, one is returned. If
neither, then None is returned.
@@ -101,9 +101,9 @@ def join_host_port(host: str, port: int) -> str:
This is a minimal implementation intended to cope with IPv6 literals. For
example, _join_host_port('::1', 80) == '[::1]:80'.
- :Args:
- - host - hostname or IP
- - port - port number
+ Args:
+ host: hostname or IP
+ port: port number
"""
if ":" in host and not host.startswith("["):
return f"[{host}]:{port}"
@@ -113,9 +113,9 @@ def join_host_port(host: str, port: int) -> str:
def is_connectable(port: int, host: Optional[str] = "localhost") -> bool:
"""Tries to connect to the server at port to see if it is running.
- :Args:
- - port - port number
- - host - hostname or IP
+ Args:
+ port: port number
+ host: hostname or IP
"""
socket_ = None
try:
@@ -141,10 +141,10 @@ def is_url_connectable(
"""Sends a request to the HTTP server at the /status endpoint to see if it
responds successfully.
- :Args:
- - port - port number
- - host - hostname or IP
- - scheme - URL scheme
+ Args:
+ port: port number
+ host: hostname or IP
+ scheme: URL scheme
"""
try:
with urllib.request.urlopen(f"{scheme}://{host}:{port}/status") as res:
diff --git a/py/selenium/webdriver/common/virtual_authenticator.py b/py/selenium/webdriver/common/virtual_authenticator.py
index c0ae055e1e068..ed19df6e825ca 100644
--- a/py/selenium/webdriver/common/virtual_authenticator.py
+++ b/py/selenium/webdriver/common/virtual_authenticator.py
@@ -88,13 +88,13 @@ def __init__(
"""Constructor. A credential stored in a virtual authenticator.
https://w3c.github.io/webauthn/#credential-parameters.
- :Args:
- - credential_id (bytes): Unique base64 encoded string.
- - is_resident_credential (bool): Whether the credential is client-side discoverable.
- - rp_id (str): Relying party identifier.
- - user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string. Can be None.
- - private_key (bytes): Base64 encoded PKCS#8 private key.
- - sign_count (int): initial value for a signature counter.
+ Args:
+ credential_id (bytes): Unique base64 encoded string.
+ is_resident_credential (bool): Whether the credential is client-side discoverable.
+ rp_id (str): Relying party identifier.
+ user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string. Can be None.
+ private_key (bytes): Base64 encoded PKCS#8 private key.
+ sign_count (int): initial value for a signature counter.
"""
self._id = credential_id
self._is_resident_credential = is_resident_credential
@@ -133,14 +133,14 @@ def sign_count(self) -> int:
def create_non_resident_credential(cls, id: bytes, rp_id: str, private_key: bytes, sign_count: int) -> "Credential":
"""Creates a non-resident (i.e. stateless) credential.
- :Args:
- - id (bytes): Unique base64 encoded string.
- - rp_id (str): Relying party identifier.
- - private_key (bytes): Base64 encoded PKCS
- - sign_count (int): initial value for a signature counter.
+ Args:
+ id (bytes): Unique base64 encoded string.
+ rp_id (str): Relying party identifier.
+ private_key (bytes): Base64 encoded PKCS
+ sign_count (int): initial value for a signature counter.
- :Returns:
- - Credential: A non-resident credential.
+ Returns:
+ Credential: A non-resident credential.
"""
return cls(id, False, rp_id, None, private_key, sign_count)
@@ -150,15 +150,15 @@ def create_resident_credential(
) -> "Credential":
"""Creates a resident (i.e. stateful) credential.
- :Args:
- - id (bytes): Unique base64 encoded string.
- - rp_id (str): Relying party identifier.
- - user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string.
- - private_key (bytes): Base64 encoded PKCS
- - sign_count (int): initial value for a signature counter.
+ Args:
+ id (bytes): Unique base64 encoded string.
+ rp_id (str): Relying party identifier.
+ user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string.
+ private_key (bytes): Base64 encoded PKCS
+ sign_count (int): initial value for a signature counter.
- :returns:
- - Credential: A resident credential.
+ Returns:
+ Credential: A resident credential.
"""
return cls(id, True, rp_id, user_handle, private_key, sign_count)
diff --git a/py/selenium/webdriver/edge/webdriver.py b/py/selenium/webdriver/edge/webdriver.py
index 4cac95d68ef5c..4d8d895ad48fa 100644
--- a/py/selenium/webdriver/edge/webdriver.py
+++ b/py/selenium/webdriver/edge/webdriver.py
@@ -32,13 +32,16 @@ def __init__(
service: Optional[Service] = None,
keep_alive: bool = True,
) -> None:
- """Creates a new instance of the edge driver. Starts the service and
- then creates new instance of edge driver.
+ """Creates a new instance of the edge driver.
- :Args:
- - options - this takes an instance of EdgeOptions
- - service - Service object for handling the browser driver if you need to pass extra details
- - keep_alive - Whether to configure EdgeRemoteConnection to use HTTP keep-alive.
+ Starts the service and then creates new instance of edge driver.
+
+ Args:
+ options: An instance of EdgeOptions.
+ service: Service object for handling the browser driver if you need
+ to pass extra details.
+ keep_alive: Whether to configure EdgeRemoteConnection to use HTTP
+ keep-alive.
"""
service = service if service else Service()
options = options if options else Options()
diff --git a/py/selenium/webdriver/ie/options.py b/py/selenium/webdriver/ie/options.py
index 0775acc7a9693..82cba38f57657 100644
--- a/py/selenium/webdriver/ie/options.py
+++ b/py/selenium/webdriver/ie/options.py
@@ -27,9 +27,9 @@ class ElementScrollBehavior(Enum):
class _IeOptionsDescriptor:
- """_IeOptionsDescriptor is an implementation of Descriptor Protocol:
+ """_IeOptionsDescriptor is an implementation of Descriptor Protocol.
- : Any look-up or assignment to the below attributes in `Options` class will be intercepted
+ Any look-up or assignment to the below attributes in `Options` class will be intercepted
by `__get__` and `__set__` method respectively.
- `browser_attach_timeout`
@@ -50,13 +50,15 @@ class _IeOptionsDescriptor:
- `attach_to_edge_chrome`
- `edge_executable_path`
+ When an attribute lookup happens:
- : When an attribute lookup happens,
Example:
`self. browser_attach_timeout`
`__get__` method does a dictionary look up in the dictionary `_options` in `Options` class
and returns the value of key `browserAttachTimeout`
- : When an attribute assignment happens,
+
+ When an attribute assignment happens:
+
Example:
`self.browser_attach_timeout` = 30
`__set__` method sets/updates the value of the key `browserAttachTimeout` in `_options`
@@ -368,20 +370,26 @@ def __init__(self) -> None:
@property
def options(self) -> dict:
- """:Returns: A dictionary of browser options."""
+ """
+ Returns:
+ A dictionary of browser options.
+ """
return self._options
@property
def additional_options(self) -> dict:
- """:Returns: The additional options."""
+ """
+ Returns:
+ The additional options.
+ """
return self._additional
def add_additional_option(self, name: str, value) -> None:
"""Adds an additional option not yet added as a safe option for IE.
- :Args:
- - name: name of the option to add
- - value: value of the option to add
+ Args:
+ name: name of the option to add
+ value: value of the option to add
"""
self._additional[name] = value
diff --git a/py/selenium/webdriver/ie/service.py b/py/selenium/webdriver/ie/service.py
index be00ff3e64995..61932c9668509 100644
--- a/py/selenium/webdriver/ie/service.py
+++ b/py/selenium/webdriver/ie/service.py
@@ -38,16 +38,16 @@ def __init__(
) -> None:
"""Creates a new instance of the Service.
- :Args:
- - executable_path : Path to the IEDriver
- - port : Port the service is running on
- - host : (Optional) IP address the service port is bound
- - service_args: (Optional) Sequence of args to be passed to the subprocess when launching the executable.
- - log_level : (Optional) Level of logging of service, may be "FATAL", "ERROR", "WARN", "INFO", "DEBUG",
- "TRACE". Default is "FATAL".
- - log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file.
- Default is "stdout".
- - driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable.
+ Args:
+ executable_path: Path to the IEDriver
+ port: Port the service is running on
+ host: (Optional) IP address the service port is bound
+ service_args: (Optional) Sequence of args to be passed to the subprocess when launching the executable.
+ log_level: (Optional) Level of logging of service, may be "FATAL", "ERROR", "WARN", "INFO", "DEBUG",
+ "TRACE". Default is "FATAL".
+ log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file.
+ Default is "stdout".
+ driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable.
"""
self._service_args = list(service_args or [])
driver_path_env_key = driver_path_env_key or "SE_IEDRIVER"
diff --git a/py/selenium/webdriver/ie/webdriver.py b/py/selenium/webdriver/ie/webdriver.py
index 1454eb2af90d9..9029425b8e747 100644
--- a/py/selenium/webdriver/ie/webdriver.py
+++ b/py/selenium/webdriver/ie/webdriver.py
@@ -39,10 +39,10 @@ def __init__(
Starts the service and then creates new instance of Ie driver.
- :Args:
- - options - IE Options instance, providing additional IE options
- - service - (Optional) service instance for managing the starting and stopping of the driver.
- - keep_alive - Whether to configure RemoteConnection to use HTTP keep-alive.
+ Args:
+ options: IE Options instance, providing additional IE options
+ service: (Optional) service instance for managing the starting and stopping of the driver.
+ keep_alive: Whether to configure RemoteConnection to use HTTP keep-alive.
"""
self.service = service if service else Service()
diff --git a/py/selenium/webdriver/remote/errorhandler.py b/py/selenium/webdriver/remote/errorhandler.py
index 5a2b8f038f9b7..050970206f757 100644
--- a/py/selenium/webdriver/remote/errorhandler.py
+++ b/py/selenium/webdriver/remote/errorhandler.py
@@ -53,9 +53,9 @@
class ExceptionMapping:
- """
- :Maps each errorcode in ErrorCode object to corresponding exception
- Please refer to https://www.w3.org/TR/webdriver2/#errors for w3c specification
+ """Maps each errorcode in ErrorCode object to corresponding exception.
+
+ Please refer to https://www.w3.org/TR/webdriver2/#errors for w3c specification.
"""
NO_SUCH_ELEMENT = NoSuchElementException
@@ -146,11 +146,12 @@ def check_response(self, response: dict[str, Any]) -> None:
"""Checks that a JSON response from the WebDriver does not have an
error.
- :Args:
- - response - The JSON response from the WebDriver server as a dictionary
- object.
+ Args:
+ response: The JSON response from the WebDriver server as a dictionary
+ object.
- :Raises: If the response contains an error message.
+ Raises:
+ WebDriverException: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
diff --git a/py/selenium/webdriver/remote/switch_to.py b/py/selenium/webdriver/remote/switch_to.py
index 30a26ed760f39..0f9e5418bae24 100644
--- a/py/selenium/webdriver/remote/switch_to.py
+++ b/py/selenium/webdriver/remote/switch_to.py
@@ -34,10 +34,8 @@ def __init__(self, driver) -> None:
def active_element(self) -> WebElement:
"""Returns the element with focus, or BODY if nothing has focus.
- :Usage:
- ::
-
- element = driver.switch_to.active_element
+ Example:
+ element = driver.switch_to.active_element
"""
return self._driver.execute(Command.W3C_GET_ACTIVE_ELEMENT)["value"]
@@ -45,10 +43,8 @@ def active_element(self) -> WebElement:
def alert(self) -> Alert:
"""Switches focus to an alert on the page.
- :Usage:
- ::
-
- alert = driver.switch_to.alert
+ Example:
+ alert = driver.switch_to.alert
"""
alert = Alert(self._driver)
_ = alert.text
@@ -57,10 +53,8 @@ def alert(self) -> Alert:
def default_content(self) -> None:
"""Switch focus to the default frame.
- :Usage:
- ::
-
- driver.switch_to.default_content()
+ Example:
+ driver.switch_to.default_content()
"""
self._driver.execute(Command.SWITCH_TO_FRAME, {"id": None})
@@ -68,13 +62,11 @@ def frame(self, frame_reference: Union[str, int, WebElement]) -> None:
"""Switches focus to the specified frame, by index, name, or
webelement.
- :Args:
- - frame_reference: The name of the window to switch to, an integer representing the index,
- or a webelement that is an (i)frame to switch to.
-
- :Usage:
- ::
+ Args:
+ frame_reference: The name of the window to switch to, an integer representing the index,
+ or a webelement that is an (i)frame to switch to.
+ Example:
driver.switch_to.frame("frame_name")
driver.switch_to.frame(1)
driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
@@ -96,9 +88,7 @@ def new_window(self, type_hint: Optional[str] = None) -> None:
The type hint can be one of "tab" or "window". If not specified the
browser will automatically select it.
- :Usage:
- ::
-
+ Example:
driver.switch_to.new_window("tab")
"""
value = self._driver.execute(Command.NEW_WINDOW, {"type": type_hint})["value"]
@@ -108,9 +98,7 @@ def parent_frame(self) -> None:
"""Switches focus to the parent context. If the current context is the
top level browsing context, the context remains unchanged.
- :Usage:
- ::
-
+ Example:
driver.switch_to.parent_frame()
"""
self._driver.execute(Command.SWITCH_TO_PARENT_FRAME)
@@ -118,13 +106,11 @@ def parent_frame(self) -> None:
def window(self, window_name: str) -> None:
"""Switches focus to the specified window.
- :Args:
- - window_name: The name or window handle of the window to switch to.
-
- :Usage:
- ::
+ Args:
+ window_name: The name or window handle of the window to switch to.
- driver.switch_to.window("main")
+ Example:
+ driver.switch_to.window("main")
"""
self._w3c_window(window_name)
diff --git a/py/selenium/webdriver/safari/webdriver.py b/py/selenium/webdriver/safari/webdriver.py
index 43d577357ed54..c0dae2a8c282a 100644
--- a/py/selenium/webdriver/safari/webdriver.py
+++ b/py/selenium/webdriver/safari/webdriver.py
@@ -37,11 +37,11 @@ def __init__(
"""Creates a new Safari driver instance and launches or finds a running
safaridriver service.
- :Args:
- - keep_alive - Whether to configure SafariRemoteConnection to use
- HTTP keep-alive. Defaults to True.
- - options - Instance of ``options.Options``.
- - service - Service object for handling the browser driver if you need to pass extra details
+ Args:
+ keep_alive: Whether to configure SafariRemoteConnection to use
+ HTTP keep-alive. Defaults to True.
+ options: Instance of ``options.Options``.
+ service: Service object for handling the browser driver if you need to pass extra details
"""
self.service = service if service else Service()
options = options if options else Options()
diff --git a/py/selenium/webdriver/support/event_firing_webdriver.py b/py/selenium/webdriver/support/event_firing_webdriver.py
index 7edbf4560cbb9..b113d1189bc1c 100644
--- a/py/selenium/webdriver/support/event_firing_webdriver.py
+++ b/py/selenium/webdriver/support/event_firing_webdriver.py
@@ -42,15 +42,12 @@ class EventFiringWebDriver:
def __init__(self, driver: WebDriver, event_listener: AbstractEventListener) -> None:
"""Creates a new instance of the EventFiringWebDriver.
- :Args:
- - driver : A WebDriver instance
- - event_listener : Instance of a class that subclasses AbstractEventListener and implements it fully
- or partially
+ Args:
+ driver: A WebDriver instance
+ event_listener: Instance of a class that subclasses AbstractEventListener and implements it fully
+ or partially
Example:
-
- ::
-
from selenium.webdriver import Firefox
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
@@ -77,8 +74,10 @@ def after_navigate_to(self, url, driver):
@property
def wrapped_driver(self) -> WebDriver:
- """Returns the WebDriver instance wrapped by this
- EventsFiringWebDriver."""
+ """
+ Returns:
+ The WebDriver instance wrapped by this EventsFiringWebDriver.
+ """
return self._driver
def get(self, url: str) -> None:
@@ -173,8 +172,10 @@ def __init__(self, webelement: WebElement, ef_driver: EventFiringWebDriver) -> N
@property
def wrapped_element(self) -> WebElement:
- """Returns the WebElement wrapped by this EventFiringWebElement
- instance."""
+ """
+ Returns:
+ The WebElement wrapped by this EventFiringWebElement instance.
+ """
return self._webelement
def click(self) -> None:
diff --git a/py/selenium/webdriver/support/relative_locator.py b/py/selenium/webdriver/support/relative_locator.py
index 5962ae128c874..a8f5b715e6e4b 100644
--- a/py/selenium/webdriver/support/relative_locator.py
+++ b/py/selenium/webdriver/support/relative_locator.py
@@ -25,25 +25,18 @@
def with_tag_name(tag_name: str) -> "RelativeBy":
"""Start searching for relative objects using a tag name.
- Parameters:
- -----------
- tag_name : str
- The DOM tag of element to start searching.
+ Args:
+ tag_name: The DOM tag of element to start searching.
Returns:
- --------
- RelativeBy
- Use this object to create filters within a `find_elements` call.
+ RelativeBy: Use this object to create filters within a `find_elements` call.
Raises:
- -------
- WebDriverException
- If `tag_name` is None.
-
- Notes:
- ------
- - This method is deprecated and may be removed in future versions.
- - Please use `locate_with` instead.
+ WebDriverException: If `tag_name` is None.
+
+ Note:
+ This method is deprecated and may be removed in future versions.
+ Please use `locate_with` instead.
"""
warnings.warn("This method is deprecated and may be removed in future versions. Please use `locate_with` instead.")
if not tag_name:
@@ -54,23 +47,16 @@ def with_tag_name(tag_name: str) -> "RelativeBy":
def locate_with(by: ByType, using: str) -> "RelativeBy":
"""Start searching for relative objects your search criteria with By.
- Parameters:
- -----------
- by : ByType
- The method to find the element.
-
- using : str
- The value from `By` passed in.
+ Args:
+ by: The method to find the element.
+ using: The value from `By` passed in.
Returns:
- --------
- RelativeBy
- Use this object to create filters within a `find_elements` call.
+ RelativeBy: Use this object to create filters within a `find_elements` call.
Example:
- --------
- >>> lowest = driver.find_element(By.ID, "below")
- >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").above(lowest))
+ >>> lowest = driver.find_element(By.ID, "below")
+ >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").above(lowest))
"""
assert by is not None, "Please pass in a by argument"
assert using is not None, "Please pass in a using argument"
@@ -97,13 +83,9 @@ def __init__(self, root: Optional[dict[ByType, str]] = None, filters: Optional[l
"""Creates a new RelativeBy object. It is preferred if you use the
`locate_with` method as this signature could change.
- Attributes:
- -----------
- root : Dict[By, str]
- - A dict with `By` enum as the key and the search query as the value
-
- filters : List
- - A list of the filters that will be searched. If none are passed
+ Args:
+ root: A dict with `By` enum as the key and the search query as the value
+ filters: A list of the filters that will be searched. If none are passed
in please use the fluent API on the object to create the filters
"""
self.root = root
@@ -118,19 +100,14 @@ def above(self, element_or_locator: None = None) -> "NoReturn": ...
def above(self, element_or_locator: Union[WebElement, LocatorType, None] = None) -> "RelativeBy":
"""Add a filter to look for elements above.
- Parameters:
- -----------
- element_or_locator : Union[WebElement, Dict, None]
- Element to look above
+ Args:
+ element_or_locator: Element to look above
Returns:
- --------
- RelativeBy
+ RelativeBy
Raises:
- -------
- WebDriverException
- If `element_or_locator` is None.
+ WebDriverException: If `element_or_locator` is None.
Example:
--------
@@ -152,24 +129,18 @@ def below(self, element_or_locator: None = None) -> "NoReturn": ...
def below(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements below.
- Parameters:
- -----------
- element_or_locator : Union[WebElement, Dict, None]
- Element to look below
+ Args:
+ element_or_locator: Element to look below
Returns:
- --------
- RelativeBy
+ RelativeBy
Raises:
- -------
- WebDriverException
- If `element_or_locator` is None.
+ WebDriverException: If `element_or_locator` is None.
Example:
- --------
- >>> highest = driver.find_element(By.ID, "high")
- >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").below(highest))
+ >>> highest = driver.find_element(By.ID, "high")
+ >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").below(highest))
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling below method")
@@ -186,24 +157,18 @@ def to_left_of(self, element_or_locator: None = None) -> "NoReturn": ...
def to_left_of(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements to the left of.
- Parameters:
- -----------
- element_or_locator : Union[WebElement, Dict, None]
- Element to look to the left of
+ Args:
+ element_or_locator: Element to look to the left of
Returns:
- --------
- RelativeBy
+ RelativeBy
Raises:
- -------
- WebDriverException
- If `element_or_locator` is None.
+ WebDriverException: If `element_or_locator` is None.
Example:
- --------
- >>> right = driver.find_element(By.ID, "right")
- >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_left_of(right))
+ >>> right = driver.find_element(By.ID, "right")
+ >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_left_of(right))
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling to_left_of method")
@@ -220,24 +185,18 @@ def to_right_of(self, element_or_locator: None = None) -> "NoReturn": ...
def to_right_of(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements right of.
- Parameters:
- -----------
- element_or_locator : Union[WebElement, Dict, None]
- Element to look right of
+ Args:
+ element_or_locator: Element to look right of
Returns:
- --------
- RelativeBy
+ RelativeBy
Raises:
- -------
- WebDriverException
- If `element_or_locator` is None.
+ WebDriverException: If `element_or_locator` is None.
Example:
- --------
- >>> left = driver.find_element(By.ID, "left")
- >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_right_of(left))
+ >>> left = driver.find_element(By.ID, "left")
+ >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_right_of(left))
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling to_right_of method")
@@ -254,8 +213,8 @@ def straight_above(self, element_or_locator: None = None) -> "NoReturn": ...
def straight_above(self, element_or_locator: Union[WebElement, LocatorType, None] = None) -> "RelativeBy":
"""Add a filter to look for elements above.
- :Args:
- - element_or_locator: Element to look above
+ Args:
+ element_or_locator: Element to look above
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling above method")
@@ -272,8 +231,8 @@ def straight_below(self, element_or_locator: None = None) -> "NoReturn": ...
def straight_below(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements below.
- :Args:
- - element_or_locator: Element to look below
+ Args:
+ element_or_locator: Element to look below
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling below method")
@@ -290,8 +249,8 @@ def straight_left_of(self, element_or_locator: None = None) -> "NoReturn": ...
def straight_left_of(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements to the left of.
- :Args:
- - element_or_locator: Element to look to the left of
+ Args:
+ element_or_locator: Element to look to the left of
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling to_left_of method")
@@ -308,8 +267,8 @@ def straight_right_of(self, element_or_locator: None = None) -> "NoReturn": ...
def straight_right_of(self, element_or_locator: Union[WebElement, dict, None] = None) -> "RelativeBy":
"""Add a filter to look for elements right of.
- :Args:
- - element_or_locator: Element to look right of
+ Args:
+ element_or_locator: Element to look right of
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling to_right_of method")
@@ -326,28 +285,20 @@ def near(self, element_or_locator: None = None, distance: int = 50) -> "NoReturn
def near(self, element_or_locator: Union[WebElement, LocatorType, None] = None, distance: int = 50) -> "RelativeBy":
"""Add a filter to look for elements near.
- Parameters:
- -----------
- element_or_locator : Union[WebElement, Dict, None]
- Element to look near by the element or within a distance
-
- distance : int
- Distance in pixel
+ Args:
+ element_or_locator: Element to look near by the element or within a distance
+ distance: Distance in pixel
Returns:
- --------
- RelativeBy
+ RelativeBy
Raises:
- -------
- WebDriverException
- - If `element_or_locator` is None
- - If `distance` is less than or equal to 0.
+ WebDriverException: If `element_or_locator` is None
+ WebDriverException: If `distance` is less than or equal to 0.
Example:
- --------
- >>> near = driver.find_element(By.ID, "near")
- >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").near(near, 50))
+ >>> near = driver.find_element(By.ID, "near")
+ >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").near(near, 50))
"""
if not element_or_locator:
raise WebDriverException("Element or locator must be given when calling near method")
diff --git a/py/selenium/webdriver/support/select.py b/py/selenium/webdriver/support/select.py
index 23140b2e60f08..33a8459be47be 100644
--- a/py/selenium/webdriver/support/select.py
+++ b/py/selenium/webdriver/support/select.py
@@ -26,8 +26,8 @@ def __init__(self, webelement: WebElement) -> None:
"""Constructor. A check is made that the given element is, indeed, a
SELECT tag. If it is not, then an UnexpectedTagNameException is thrown.
- :Args:
- - webelement - SELECT element to wrap
+ Args:
+ webelement: SELECT element to wrap
Example:
from selenium.webdriver.support.ui import Select \n
@@ -65,10 +65,11 @@ def select_by_value(self, value: str) -> None:
- :Args:
- - value - The value to match against
+ Args:
+ value: The value to match against
- throws NoSuchElementException If there is no option with specified value in SELECT
+ Raises:
+ NoSuchElementException: If there is no option with specified value in SELECT
"""
css = f"option[value ={self._escape_string(value)}]"
opts = self._el.find_elements(By.CSS_SELECTOR, css)
@@ -85,10 +86,11 @@ def select_by_index(self, index: int) -> None:
"""Select the option at the given index. This is done by examining the
"index" attribute of an element, and not merely by counting.
- :Args:
- - index - The option at this index will be selected
+ Args:
+ index: The option at this index will be selected
- throws NoSuchElementException If there is no option with specified index in SELECT
+ Raises:
+ NoSuchElementException: If there is no option with specified index in SELECT
"""
match = str(index)
for opt in self.options:
@@ -103,10 +105,11 @@ def select_by_visible_text(self, text: str) -> None:
- :Args:
- - text - The visible text to match against
+ Args:
+ text: The visible text to match against
- throws NoSuchElementException If there is no option with specified text in SELECT
+ Raises:
+ NoSuchElementException: If there is no option with specified text in SELECT
"""
xpath = f".//option[normalize-space(.) = {self._escape_string(text)}]"
opts = self._el.find_elements(By.XPATH, xpath)
@@ -156,10 +159,11 @@ def deselect_by_value(self, value: str) -> None:
- :Args:
- - value - The value to match against
+ Args:
+ value: The value to match against
- throws NoSuchElementException If there is no option with specified value in SELECT
+ Raises:
+ NoSuchElementException: If there is no option with specified value in SELECT
"""
if not self.is_multiple:
raise NotImplementedError("You may only deselect options of a multi-select")
@@ -176,10 +180,11 @@ def deselect_by_index(self, index: int) -> None:
"""Deselect the option at the given index. This is done by examining
the "index" attribute of an element, and not merely by counting.
- :Args:
- - index - The option at this index will be deselected
+ Args:
+ index: The option at this index will be deselected
- throws NoSuchElementException If there is no option with specified index in SELECT
+ Raises:
+ NoSuchElementException: If there is no option with specified index in SELECT
"""
if not self.is_multiple:
raise NotImplementedError("You may only deselect options of a multi-select")
@@ -195,8 +200,8 @@ def deselect_by_visible_text(self, text: str) -> None:
- :Args:
- - text - The visible text to match against
+ Args:
+ text: The visible text to match against
"""
if not self.is_multiple:
raise NotImplementedError("You may only deselect options of a multi-select")
@@ -250,8 +255,8 @@ def _has_css_property_and_visible(self, option) -> bool:
css_value_candidates = ["hidden", "none", "0", "0.0"]
css_property_candidates = ["visibility", "display", "opacity"]
- for property in css_property_candidates:
- css_value = option.value_of_css_property(property)
+ for css_property in css_property_candidates:
+ css_value = option.value_of_css_property(css_property)
if css_value in css_value_candidates:
return False
return True
diff --git a/py/selenium/webdriver/webkitgtk/options.py b/py/selenium/webdriver/webkitgtk/options.py
index bb2d82d64d81e..c6db4097c9502 100644
--- a/py/selenium/webdriver/webkitgtk/options.py
+++ b/py/selenium/webdriver/webkitgtk/options.py
@@ -29,30 +29,35 @@ def __init__(self) -> None:
@property
def binary_location(self) -> str:
- """:Returns: The location of the browser binary otherwise an empty
- string."""
+ """
+ Returns:
+ The location of the browser binary, otherwise an empty string.
+ """
return self._binary_location
@binary_location.setter
def binary_location(self, value: str) -> None:
"""Allows you to set the browser binary to launch.
- :Args:
- - value : path to the browser binary
+ Args:
+ value: path to the browser binary
"""
self._binary_location = value
@property
def overlay_scrollbars_enabled(self):
- """:Returns: Whether overlay scrollbars should be enabled."""
+ """
+ Returns:
+ Whether overlay scrollbars should be enabled.
+ """
return self._overlay_scrollbars_enabled
@overlay_scrollbars_enabled.setter
def overlay_scrollbars_enabled(self, value) -> None:
"""Allows you to enable or disable overlay scrollbars.
- :Args:
- - value : True or False
+ Args:
+ value: True or False
"""
self._overlay_scrollbars_enabled = value
diff --git a/py/selenium/webdriver/webkitgtk/webdriver.py b/py/selenium/webdriver/webkitgtk/webdriver.py
index a7d80ee32abaa..0c81dc6f70c12 100644
--- a/py/selenium/webdriver/webkitgtk/webdriver.py
+++ b/py/selenium/webdriver/webkitgtk/webdriver.py
@@ -36,9 +36,9 @@ def __init__(
Starts the service and then creates new instance of WebKitGTK Driver.
- :Args:
- - options : an instance of WebKitGTKOptions
- - service : Service object for handling the browser driver if you need to pass extra details
+ Args:
+ options: an instance of WebKitGTKOptions
+ service: Service object for handling the browser driver if you need to pass extra details
"""
options = options if options else Options()
diff --git a/py/selenium/webdriver/wpewebkit/options.py b/py/selenium/webdriver/wpewebkit/options.py
index 23fc3349c4bc1..4a65b3bcd92a8 100644
--- a/py/selenium/webdriver/wpewebkit/options.py
+++ b/py/selenium/webdriver/wpewebkit/options.py
@@ -37,8 +37,8 @@ def binary_location(self) -> str:
def binary_location(self, value: str) -> None:
"""Allows you to set the browser binary to launch.
- :Args:
- - value : path to the browser binary
+ Args:
+ value: path to the browser binary
"""
if not isinstance(value, str):
raise TypeError(self.BINARY_LOCATION_ERROR)
diff --git a/py/selenium/webdriver/wpewebkit/webdriver.py b/py/selenium/webdriver/wpewebkit/webdriver.py
index a14959075d6ed..5c10b5aa6e27c 100644
--- a/py/selenium/webdriver/wpewebkit/webdriver.py
+++ b/py/selenium/webdriver/wpewebkit/webdriver.py
@@ -36,9 +36,9 @@ def __init__(
Starts the service and then creates new instance of WPEWebKit Driver.
- :Args:
- - options : an instance of ``WPEWebKitOptions``
- - service : Service object for handling the browser driver if you need to pass extra details
+ Args:
+ options: an instance of ``WPEWebKitOptions``
+ service: Service object for handling the browser driver if you need to pass extra details
"""
options = options if options else Options()