From e9c09a200e374bba63acb0ef605175abb125e82e Mon Sep 17 00:00:00 2001 From: Augustin Gottlieb <33221555+aguspe@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:30:35 +0100 Subject: [PATCH] [rb] Deprecate CDP methods on Firefox (#14763) * Deprecate CDP for firefox * Make the deprecation message less generic --- .../webdriver/common/driver_extensions/has_log_events.rb | 7 +++++++ .../common/driver_extensions/has_network_interception.rb | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/rb/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb b/rb/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb index 1965466633f08..8acadbe0b8519 100644 --- a/rb/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +++ b/rb/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb @@ -57,6 +57,13 @@ module HasLogEvents # def on_log_event(kind, &block) + if browser == :firefox + WebDriver.logger.deprecate( + 'Driver#on_log_event on Firefox', + 'the script.add_console_message_handler or the script.add_javascript_error_handler methods', + id: :on_log_event + ) + end raise Error::WebDriverError, "Don't know how to handle #{kind} events" unless KINDS.include?(kind) enabled = log_listeners[kind].any? diff --git a/rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb b/rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb index 3339426157d91..54abcecba87c7 100644 --- a/rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +++ b/rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb @@ -60,6 +60,13 @@ module HasNetworkInterception # def intercept(&) + if browser == :firefox + WebDriver.logger.deprecate( + 'Driver#intercept on Firefox', + 'the new bidi.network.add_intercept method', + id: :intercept + ) + end @interceptor ||= DevTools::NetworkInterceptor.new(devtools) @interceptor.intercept(&) end