|
14 | 14 | # KIND, either express or implied. See the License for the
|
15 | 15 | # specific language governing permissions and limitations
|
16 | 16 | # under the License.
|
17 |
| - |
18 |
| -from typing import List |
| 17 | +import typing |
19 | 18 |
|
20 | 19 | from selenium.webdriver.chromium import service
|
21 | 20 |
|
22 | 21 | DEFAULT_EXECUTABLE_PATH = "chromedriver"
|
23 | 22 |
|
24 | 23 |
|
25 | 24 | class Service(service.ChromiumService):
|
26 |
| - """ |
27 |
| - Object that manages the starting and stopping of the ChromeDriver |
| 25 | + """A Service class that is responsible for the starting and stopping |
| 26 | + of `chromedriver`. |
| 27 | +
|
| 28 | + :param executable_path: install path of the chromedriver executable, defaults to `chromedriver`. |
| 29 | + :param port: Port for the service to run on, defaults to 0 where the operating system will decide. |
| 30 | + :param service_args: (Optional) Sequence of args/flags to be passed to the `chromedriver` subprocess. |
| 31 | + :param log_path: (Optional) String to be passed to the executable as `--log-path` |
| 32 | + :param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`. |
28 | 33 | """
|
29 | 34 |
|
30 | 35 | def __init__(
|
31 | 36 | self,
|
32 | 37 | executable_path: str = DEFAULT_EXECUTABLE_PATH,
|
33 | 38 | port: int = 0,
|
34 |
| - service_args: List[str] = None, |
35 |
| - log_path: str = None, |
36 |
| - env: dict = None, |
37 |
| - ): |
38 |
| - """ |
39 |
| - Creates a new instance of the Service |
40 |
| -
|
41 |
| - :Args: |
42 |
| - - executable_path : Path to the ChromeDriver |
43 |
| - - port : Port the service is running on |
44 |
| - - service_args : List of args to pass to the chromedriver service |
45 |
| - - log_path : Path for the chromedriver service to log to""" |
46 |
| - |
| 39 | + service_args: typing.Optional[typing.Sequence[str]] = None, |
| 40 | + log_path: typing.Optional[str] = None, |
| 41 | + env: typing.Optional[typing.Mapping[str, str]] = None, |
| 42 | + ) -> None: |
47 | 43 | super().__init__(
|
48 |
| - executable_path, port, service_args, log_path, env, "Please see https://chromedriver.chromium.org/home" |
| 44 | + executable_path=executable_path, |
| 45 | + port=port, |
| 46 | + service_args=service_args, |
| 47 | + log_path=log_path, |
| 48 | + env=env, |
| 49 | + start_error_message="Please see https://chromedriver.chromium.org/home", |
49 | 50 | )
|
0 commit comments