| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
import typing |
| 18 |
|
| 19 |
from selenium.types import SubprocessStdAlias |
| 20 |
from selenium.webdriver.chromium import service |
| 21 |
|
| 22 |
|
| 23 |
class Service(service.ChromiumService): |
| 24 |
"""A Service class that is responsible for the starting and stopping of |
| 25 |
`chromedriver`. |
| 26 |
|
| 27 |
:param executable_path: install path of the chromedriver executable, defaults to `chromedriver`. |
| 28 |
:param port: Port for the service to run on, defaults to 0 where the operating system will decide. |
| 29 |
:param service_args: (Optional) List of args to be passed to the subprocess when launching the executable. |
| 30 |
:param log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file. |
| 31 |
:param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`. |
| 32 |
""" |
| 33 |
|
| 34 |
def __init__( |
| 35 |
self, |
| 36 |
executable_path=None, |
| 37 |
port: int = 0, |
| 38 |
service_args: typing.Optional[typing.List[str]] = None, |
| 39 |
log_output: SubprocessStdAlias = None, |
| 40 |
env: typing.Optional[typing.Mapping[str, str]] = None, |
| 41 |
**kwargs, |
| 42 |
) -> None: |
| 43 |
super().__init__( |
| 44 |
executable_path=executable_path, |
| 45 |
port=port, |
| 46 |
service_args=service_args, |
| 47 |
log_output=log_output, |
| 48 |
env=env, |
| 49 |
**kwargs, |
| 50 |
) |