diff --git a/py/selenium/webdriver/chrome/service.py b/py/selenium/webdriver/chrome/service.py index bc6d3f00fb1e9..cb7096ff39753 100644 --- a/py/selenium/webdriver/chrome/service.py +++ b/py/selenium/webdriver/chrome/service.py @@ -34,6 +34,8 @@ class Service(service.ChromiumService): :param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`. """ + _service_args: list[str] + def __init__( self, executable_path: Optional[str] = None, @@ -43,7 +45,7 @@ def __init__( env: Optional[Mapping[str, str]] = None, **kwargs, ) -> None: - self._service_args = service_args or [] + self._service_args = list(service_args or []) super().__init__( executable_path=executable_path, @@ -55,11 +57,11 @@ def __init__( ) @property - def service_args(self) -> Sequence[str]: + def service_args(self) -> list[str]: return self._service_args @service_args.setter - def service_args(self, value: Sequence[str]): + def service_args(self, value: list[str]): if isinstance(value, str) or not isinstance(value, Sequence): raise TypeError("service_args must be a sequence") self._service_args = list(value) diff --git a/py/selenium/webdriver/chrome/webdriver.py b/py/selenium/webdriver/chrome/webdriver.py index 15f4aeaf6094e..55ae7c2fce9a5 100644 --- a/py/selenium/webdriver/chrome/webdriver.py +++ b/py/selenium/webdriver/chrome/webdriver.py @@ -27,6 +27,8 @@ class WebDriver(ChromiumDriver): """Controls the ChromeDriver and allows you to drive the browser.""" + service: Service + def __init__( self, options: Optional[Options] = None, diff --git a/py/selenium/webdriver/chromium/service.py b/py/selenium/webdriver/chromium/service.py index 80c79c56ca993..8c0f5873379c7 100644 --- a/py/selenium/webdriver/chromium/service.py +++ b/py/selenium/webdriver/chromium/service.py @@ -17,7 +17,7 @@ from collections.abc import Mapping, Sequence from io import IOBase -from typing import Optional +from typing import Optional, Union from selenium.types import SubprocessStdAlias from selenium.webdriver.common import service @@ -35,6 +35,9 @@ class ChromiumService(service.Service): :param driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable. """ + _service_args: list[str] + log_output: Union[None, IOBase, int, SubprocessStdAlias] + def __init__( self, executable_path: Optional[str] = None, @@ -69,11 +72,11 @@ def command_line_args(self) -> list[str]: return [f"--port={self.port}"] + self._service_args @property - def service_args(self) -> Sequence[str]: + def service_args(self) -> list[str]: return self._service_args @service_args.setter - def service_args(self, value: Sequence[str]): + def service_args(self, value: list[str]): if isinstance(value, str) or not isinstance(value, Sequence): raise TypeError("service_args must be a sequence") self._service_args = list(value) diff --git a/py/selenium/webdriver/chromium/webdriver.py b/py/selenium/webdriver/chromium/webdriver.py index 4dcf8d73e8fe0..b6e7427f12aef 100644 --- a/py/selenium/webdriver/chromium/webdriver.py +++ b/py/selenium/webdriver/chromium/webdriver.py @@ -15,12 +15,11 @@ # specific language governing permissions and limitations # under the License. -from typing import Optional +from selenium.webdriver.chromium.options import ChromiumOptions from selenium.webdriver.chromium.remote_connection import ChromiumRemoteConnection +from selenium.webdriver.chromium.service import ChromiumService from selenium.webdriver.common.driver_finder import DriverFinder -from selenium.webdriver.common.options import ArgOptions -from selenium.webdriver.common.service import Service from selenium.webdriver.remote.command import Command from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver @@ -31,10 +30,10 @@ class ChromiumDriver(RemoteWebDriver): def __init__( self, - browser_name: Optional[str] = None, - vendor_prefix: Optional[str] = None, - options: ArgOptions = ArgOptions(), - service: Optional[Service] = None, + browser_name: str, + vendor_prefix: str, + options: ChromiumOptions = ChromiumOptions(), + service: ChromiumService = ChromiumService(), keep_alive: bool = True, ) -> None: """Creates a new WebDriver instance of the ChromiumDriver. Starts the diff --git a/py/selenium/webdriver/common/service.py b/py/selenium/webdriver/common/service.py index 7dbaaacbf2861..1a9e8b96099cc 100644 --- a/py/selenium/webdriver/common/service.py +++ b/py/selenium/webdriver/common/service.py @@ -48,6 +48,8 @@ class Service(ABC): :param driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable. """ + log_output: Union[None, IOBase, int, SubprocessStdAlias] + def __init__( self, executable_path: Optional[str] = None, diff --git a/py/selenium/webdriver/edge/service.py b/py/selenium/webdriver/edge/service.py index ef53f24d8f86b..5828a6c3719bb 100644 --- a/py/selenium/webdriver/edge/service.py +++ b/py/selenium/webdriver/edge/service.py @@ -58,11 +58,11 @@ def __init__( ) @property - def service_args(self) -> Sequence[str]: + def service_args(self) -> list[str]: return self._service_args @service_args.setter - def service_args(self, value: Sequence[str]): + def service_args(self, value: list[str]): if isinstance(value, str) or not isinstance(value, Sequence): raise TypeError("service_args must be a sequence") self._service_args = list(value) diff --git a/py/selenium/webdriver/edge/webdriver.py b/py/selenium/webdriver/edge/webdriver.py index 5b7b1856dfc08..afab6eb15e1ca 100644 --- a/py/selenium/webdriver/edge/webdriver.py +++ b/py/selenium/webdriver/edge/webdriver.py @@ -27,6 +27,8 @@ class WebDriver(ChromiumDriver): """Controls the MSEdgeDriver and allows you to drive the browser.""" + service: Service + def __init__( self, options: Optional[Options] = None, diff --git a/py/selenium/webdriver/wpewebkit/service.py b/py/selenium/webdriver/wpewebkit/service.py index 2ad99e77a54a6..7491ad6805db6 100644 --- a/py/selenium/webdriver/wpewebkit/service.py +++ b/py/selenium/webdriver/wpewebkit/service.py @@ -37,6 +37,8 @@ class Service(service.Service): :param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`. """ + _service_args: list[str] + def __init__( self, executable_path: str = DEFAULT_EXECUTABLE_PATH, diff --git a/py/selenium/webdriver/wpewebkit/webdriver.py b/py/selenium/webdriver/wpewebkit/webdriver.py index 64e298cc475c5..8ef9e4cd58ddc 100644 --- a/py/selenium/webdriver/wpewebkit/webdriver.py +++ b/py/selenium/webdriver/wpewebkit/webdriver.py @@ -28,9 +28,11 @@ class WebDriver(RemoteWebDriver): """Controls the WPEWebKitDriver and allows you to drive the browser.""" + service: Service + def __init__( self, - options=None, + options: Optional[Options] = None, service: Optional[Service] = None, ): """Creates a new instance of the WPEWebKit driver.