[py]: Types and docs for `webkitgtk.service` and additional args for consistency
@@ -22,21 +22,27 @@ DEFAULT_EXECUTABLE_PATH = "WebKitWebDriver"
class Service(service.Service):
- """
- Object that manages the starting and stopping of the WebKitGTKDriver
- """
+ """A Service class that is responsible for the starting and stopping
+ of `WPEWebDriver`.
- def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH, port=0, log_path=None):
+ :param executable_path: install path of the WebKitWebDriver executable, defaults to `WebKitWebDriver`.
+ :param port: Port for the service to run on, defaults to 0 where the operating system will decide.
+ :param service_args: (Optional) Sequence of args to be passed to the subprocess when launching the executable.
+ :param log_path: (Optional) String to be passed to the executable as `--log-path`.
+ :param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`.
"""
- Creates a new instance of the Service
- :Args:
- - executable_path : Path to the WebKitGTKDriver
- - port : Port the service is running on
- - log_path : Path for the WebKitGTKDriver service to log to
- """
+ def __init__(
+ self,
+ executable_path: str = DEFAULT_EXECUTABLE_PATH,
+ port: int = 0,
+ log_path: typing.Optional[str] = None,
+ service_args: typing.Optional[typing.Sequence[str]] = None,
+ env: typing.Optional[typing.Mapping[str, str]] = None,
+ ):
+ self.service_args = service_args or []
log_file = open(log_path, "wb") if log_path else None
- super().__init__(executable_path, port, log_file)
+ super().__init__(executable=executable_path, port=port, log_file=log_file, env=env)
def command_line_args(self) -> typing.List[str]:
- return ["-p", f"{self.port}"]
+ return ["-p", f"{self.port}"] + self.service_args
