From af3635cb9720c3a7342df77fd85239caee479e86 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Fri, 5 Jun 2026 22:26:52 +0300 Subject: [PATCH 1/2] feat!: remove Wait Until Network Is Idle keyword --- Browser/keywords/network.py | 24 ----------------------- atest/test/03_Waiting/wait_for_http.robot | 7 ------- 2 files changed, 31 deletions(-) diff --git a/Browser/keywords/network.py b/Browser/keywords/network.py index 086b8b21c..d8bc0832d 100644 --- a/Browser/keywords/network.py +++ b/Browser/keywords/network.py @@ -259,30 +259,6 @@ def wait_for_response( logger.debug(f"Returned response is of type {type(response)}") return response - @keyword(tags=("Wait", "HTTP")) - def wait_until_network_is_idle(self, timeout: timedelta | None = None): - """*DEPRECATED!!* Use `Wait For Load State` instead. rfbrowser transform --wait-until-network-is-idle path/to/test command automatically transforms keyword to new format. - - If you have: - | `Wait Until Network Is Idle` timeout=3s - then change it to: - | `Wait For Load State` networkidle timeout=3s - - Waits until there has been at least one instance of 500 ms of no network traffic on the page after loading. - - Doesn't wait for network traffic that wasn't initiated within 500ms of page load. - - | =Arguments= | =Description= | - | ``timeout`` | Timeout supports Robot Framework time format. Uses browser timeout if not set. | - - Example: - | `Go To` ${URL} - | `Wait Until Network Is Idle` timeout=3s - - [https://forum.robotframework.org/t//4350|Comment >>] - """ - self.library.wait_for_load_state(PageLoadStates.networkidle, timeout) - @keyword(tags=("Wait", "HTTP")) def wait_for_navigation( self, diff --git a/atest/test/03_Waiting/wait_for_http.robot b/atest/test/03_Waiting/wait_for_http.robot index 20e623274..1119b0d9f 100644 --- a/atest/test/03_Waiting/wait_for_http.robot +++ b/atest/test/03_Waiting/wait_for_http.robot @@ -129,13 +129,6 @@ Wait For Response With OPTIONS Request Should Be Equal As Numbers ${res2.status} 204 Should Be Equal ${res2.body} ${None} -Wait Until Network Is Idle Works - [Tags] slow - Go To ${ROOT_URL}delayed-load.html - Get Text \#server_delayed_response == Server response after 400ms - Wait Until Network Is Idle timeout=3s - Get Text \#server_delayed_response == after some time I respond - Wait For Navigation Works [Tags] slow Go To ${ROOT_URL}redirector.html From a8cdabf632da27ce207becac7606cbf291d1602d Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Fri, 5 Jun 2026 22:46:06 +0300 Subject: [PATCH 2/2] feat!: remove utils/deprecated.py --- Browser/utils/deprecated.py | 69 ------------------------------------- utest/test_deprecated.py | 51 --------------------------- 2 files changed, 120 deletions(-) delete mode 100644 Browser/utils/deprecated.py delete mode 100644 utest/test_deprecated.py diff --git a/Browser/utils/deprecated.py b/Browser/utils/deprecated.py deleted file mode 100644 index 53853ca65..000000000 --- a/Browser/utils/deprecated.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2020- Robot Framework Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import inspect -from collections.abc import Callable -from typing import Any - -from Browser.utils import logger - -from ..utils.data_types import RobotTypeConverter as TypeConverter - - -def _method_to_keyword(method: str) -> str: - keyword = "" - for word in method.split("_"): - keyword = f"{keyword} {word.capitalize()}" - return keyword.strip() - - -def _is_deprecated_attribute(method: Callable, deprecated_arg, args, kwargs): - if not deprecated_arg: - return False - args = list(args) - args.pop(0) - argspec = inspect.getfullargspec(method) - argspec_args = argspec.args - argspec_args.pop(0) - deprecated = False - if not args and not kwargs: - deprecated = False - if deprecated_arg in kwargs: - deprecated = True - for index, argspec_arg in enumerate(argspec_args): - if argspec_arg in deprecated_arg and len(args) == index + 1: - deprecated = True - return deprecated - - -def convert_pos_args_to_named( - deprecated_pos_args: tuple[Any, ...], - old_args: dict[str, Any], - keyword_name: str, - additional_msg: str = "", -): - old_args_list = list(old_args.items()) - pos_params = {} - for index, pos_arg in enumerate(deprecated_pos_args): - argument_name = old_args_list[index][0] - argument_type = old_args_list[index][1] - converted_pos = TypeConverter.converter_for(argument_type).convert( - name=argument_name, value=pos_arg - ) - pos_params[argument_name] = converted_pos - if pos_params: - logger.warn( - f"Deprecated positional arguments are used in '{keyword_name}'. " - f"Please use named arguments instead.{additional_msg}" - ) - return pos_params diff --git a/utest/test_deprecated.py b/utest/test_deprecated.py deleted file mode 100644 index a0e4917ba..000000000 --- a/utest/test_deprecated.py +++ /dev/null @@ -1,51 +0,0 @@ -import pytest - -from Browser.utils.deprecated import _is_deprecated_attribute, _method_to_keyword - - -class DummyClass: - def keyword_with_args(self, arg1, arg2): - pass - - def keyword_with(self, arg1, *args, **kwargs): - pass - - -@pytest.fixture -def keyword(): - return DummyClass().keyword_with_args - - -def test_method_to_keyword(): - assert _method_to_keyword("bar") == "Bar" - assert _method_to_keyword("BAR") == "Bar" - assert _method_to_keyword("BaR_FoO") == "Bar Foo" - - -def test_is_deprecated_no_deprecate(keyword): - assert _is_deprecated_attribute(keyword, False, (DummyClass(),), ()) is False - - -def test_is_deprecated_no_deprecate_usage(keyword): - assert _is_deprecated_attribute(keyword, "arg2", (DummyClass(),), ()) is False - assert _is_deprecated_attribute(keyword, "arg2", (DummyClass(), True), ()) is False - - -def test_test_is_deprecated_kwargs(keyword): - assert ( - _is_deprecated_attribute(keyword, "kw_arg2", (DummyClass(),), ("kw_arg2",)) - is True - ) - assert _is_deprecated_attribute(keyword, "kw_arg2", (DummyClass(),), ()) is False - assert ( - _is_deprecated_attribute(keyword, "kw_arg2", (DummyClass(),), ("kw_arg1",)) - is False - ) - - -def test_test_is_deprecated_args(keyword): - assert _is_deprecated_attribute(keyword, "arg1", (DummyClass(), True), ()) is True - assert ( - _is_deprecated_attribute(keyword, "arg2", (DummyClass(), True, True), ()) - is True - )