From ddfb3d8a87bd5faa95fc344c506e565170b1f4ff Mon Sep 17 00:00:00 2001 From: Swastik Baranwal Date: Mon, 28 Oct 2024 15:04:06 +0530 Subject: [PATCH] [py] webkitgtk: log_path -> log_output (#14618) * [py] webkitgtk: log_path -> log_output * apply suggestion * add warning for old para --------- Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> Co-authored-by: Diego Molina --- py/selenium/webdriver/webkitgtk/service.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/py/selenium/webdriver/webkitgtk/service.py b/py/selenium/webdriver/webkitgtk/service.py index 92cea26c535f3..5f42d31486143 100644 --- a/py/selenium/webdriver/webkitgtk/service.py +++ b/py/selenium/webdriver/webkitgtk/service.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. import typing +import warnings from selenium.webdriver.common import service @@ -28,7 +29,7 @@ class Service(service.Service): :param executable_path: install path of the WebKitWebDriver executable, defaults to `WebKitWebDriver`. :param port: Port for the service to run on, defaults to 0 where the operating system will decide. :param service_args: (Optional) List of args to be passed to the subprocess when launching the executable. - :param log_path: (Optional) File path for the file to be opened and passed as the subprocess stdout/stderr handler. + :param log_output: (Optional) File path for the file to be opened and passed as the subprocess stdout/stderr handler. :param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`. """ @@ -37,16 +38,20 @@ def __init__( executable_path: str = DEFAULT_EXECUTABLE_PATH, port: int = 0, log_path: typing.Optional[str] = None, + log_output: typing.Optional[str] = None, service_args: typing.Optional[typing.List[str]] = None, env: typing.Optional[typing.Mapping[str, str]] = None, **kwargs, ) -> None: self.service_args = service_args or [] - log_file = open(log_path, "wb") if log_path else None + if log_path is not None: + warnings.warn("log_path is deprecated, use log_output instead", DeprecationWarning, stacklevel=2) + log_path = open(log_path, "wb") + log_output = open(log_output, "wb") if log_output else None super().__init__( executable_path=executable_path, port=port, - log_file=log_file, + log_output=log_path or log_output, env=env, **kwargs, )