diff --git a/py/selenium/webdriver/common/service.py b/py/selenium/webdriver/common/service.py index 395a098155c53..6a2eeea87e316 100644 --- a/py/selenium/webdriver/common/service.py +++ b/py/selenium/webdriver/common/service.py @@ -21,10 +21,10 @@ import typing from abc import ABC from abc import abstractmethod +from io import IOBase from platform import system from subprocess import PIPE from time import sleep -from typing import TextIO from urllib import request from urllib.error import URLError @@ -136,7 +136,7 @@ def stop(self) -> None: """Stops the service.""" if self.log_output != PIPE: - if isinstance(self.log_output, TextIO): + if isinstance(self.log_output, IOBase): self.log_output.close() elif isinstance(self.log_output, int): os.close(self.log_output)