Skip to content

Commit

Permalink
[py]: Types and docs for webkitgtk.service and additional args for …
Browse files Browse the repository at this point in the history
…consistency
  • Loading branch information
symonk committed Oct 5, 2022
1 parent 4a759a8 commit bf37802
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions py/selenium/webdriver/webkitgtk/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,27 @@


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):
"""
Creates a new instance of the Service
: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`.
"""

: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

0 comments on commit bf37802

Please sign in to comment.