Skip to content

Commit

Permalink
introduce type AnyDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
pancht committed Mar 7, 2024
1 parent 2031a82 commit 357664e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions nrobo/selenese/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

AnyDevice = Union[PointerInput, KeyInput, WheelInput]
AnyBy = Union[By, AppiumBy]
AnyDriver = Union[None, WebDriver, AppiumWebDriver]


class WAITS:
Expand Down Expand Up @@ -86,7 +87,7 @@ class WebdriverWrapperNrobo(WebDriver):
"""Customized wrapper in nrobo of selenium-webdriver commands with enhanced functionality.
This class is not instantiable."""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger):
def __init__(self, driver: AnyDriver, logger: logging.Logger):
"""Constructor - NroboSeleniumWrapper
:param driver: reference to selenium webdriver
Expand Down Expand Up @@ -807,7 +808,7 @@ def delete_downloadable_files(self) -> None:
class WebElementWrapperNrobo(WebdriverWrapperNrobo):
"""NRobo webelement wrapper class"""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger):
def __init__(self, driver: AnyDriver, logger: logging.Logger):
"""
Constructor - NroboSeleniumWrapper
Expand Down Expand Up @@ -1072,7 +1073,7 @@ class WaitImplementationsNrobo(WebElementWrapperNrobo):
Nrobo implementation of wait methods
"""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger):
def __init__(self, driver: AnyDriver, logger: logging.Logger):
"""
Constructor - NroboSeleniumWrapper
Expand Down Expand Up @@ -1143,7 +1144,7 @@ def wait_for_element_to_be_clickable(self, timeout=None, by: AnyBy = None, value


class ActionChainsNrobo(WaitImplementationsNrobo):
def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor - NroboSeleniumWrapper
Expand All @@ -1160,7 +1161,7 @@ def action_chain(self):


class AlertNrobo(ActionChainsNrobo):
def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor - NroboSeleniumWrapper
Expand Down Expand Up @@ -1205,7 +1206,7 @@ class ByNrobo(AlertNrobo):
Wrapper class for selenium class: By
"""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor
Expand All @@ -1219,7 +1220,7 @@ def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logg
class DesiredCapabilitiesNrobo(ByNrobo):
"""Wrapper class for selenium class: DesiredCapabilities"""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor
Expand All @@ -1231,7 +1232,7 @@ def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logg


class SelectNrobo(DesiredCapabilitiesNrobo):
def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor
Expand Down Expand Up @@ -1294,7 +1295,7 @@ def __init__(self, driver, logger):
"""

def __init__(self, driver: Union[None, WebDriver, AppiumWebDriver], logger: logging.Logger, duration: int = 250,
def __init__(self, driver: AnyDriver, logger: logging.Logger, duration: int = 250,
devices: list[AnyDevice] | None = None):
"""
Constructor - NroboSeleniumWrapper
Expand Down

0 comments on commit 357664e

Please sign in to comment.