MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / start

Method start

py/selenium/webdriver/common/service.py:100–128  ·  view source on GitHub ↗

Starts the Service. Raises: WebDriverException: Raised either when it can't start the service or when it can't connect to the service

(self)

Source from the content-addressed store, hash-verified

98 self._path = str(value)
99
100 def start(self) -> None:
101 """Starts the Service.
102
103 Raises:
104 WebDriverException: Raised either when it can't start the service
105 or when it can't connect to the service
106 """
107 if self._path is None:
108 raise WebDriverException("Service path cannot be None.")
109 self._start_process(self._path)
110
111 deadline = monotonic() + self._start_timeout
112 count = 0
113 try:
114 while True:
115 self.assert_process_still_running()
116 if self.is_connectable():
117 break
118 if monotonic() >= deadline:
119 raise WebDriverException(f"Can not connect to the Service {self._path}")
120 # sleep increasing: 0.01, 0.06, 0.11, 0.16, 0.21, 0.26, 0.31, 0.36, 0.41, 0.46, 0.5
121 sleep(min(0.01 + 0.05 * count, 0.5))
122 count += 1
123 except BaseException:
124 try:
125 self.stop()
126 except Exception:
127 logger.exception("Error stopping service after a failed start.")
128 raise
129
130 def assert_process_still_running(self) -> None:
131 """Check if the underlying process is still running."""

Callers

nothing calls this directly

Calls 6

_start_processMethod · 0.95
is_connectableMethod · 0.95
stopMethod · 0.95
WebDriverExceptionClass · 0.90
exceptionMethod · 0.80

Tested by

no test coverage detected