diff --git a/appium/webdriver/appium_service.py b/appium/webdriver/appium_service.py index 37e2ddab..419fbc43 100644 --- a/appium/webdriver/appium_service.py +++ b/appium/webdriver/appium_service.py @@ -222,12 +222,15 @@ def start(self, **kwargs: Any) -> sp.Popen: raise AppiumServiceError(error_msg) return self._process - def stop(self) -> bool: + def stop(self, timeout: float = 5) -> bool: """Stops Appium service if it is running. The call will be ignored if the service is not running or has been already stopped. + Args: + timeout: timeout for process termination. + Returns: `True` if the service was running before being stopped """ @@ -235,7 +238,7 @@ def stop(self) -> bool: if self.is_running: assert self._process self._process.terminate() - self._process.communicate(timeout=5) + self._process.communicate(timeout=timeout) is_terminated = True self._process = None self._cmd = None