From 1aaf8e3ff2afae546f1ede61b23420c51f2b3766 Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Tue, 24 Nov 2026 15:58:23 +0300 Subject: [PATCH 01/15] ref(context)!: remove windows and target.window? --- CHANGELOG.md | 15 +++++++++++++++ lib/ferrum/browser.rb | 2 +- lib/ferrum/context.rb | 27 --------------------------- lib/ferrum/target.rb | 12 ------------ sig/ferrum/context.rbs | 5 ----- sig/ferrum/target.rbs | 3 --- spec/context_spec.rb | 20 -------------------- spec/target_spec.rb | 17 ----------------- 8 files changed, 16 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1554268..0394a94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [Unreleased](https://github.com/rubycdp/ferrum/compare/v0.21.0...main) ## + +### Added + +### Changed + +### Deprecated + +### Fixed + +### Removed +- `target.window?` and `windows` of a context and of the browser, use `target.opener_id`, `await_page { ... }` or + `pages(&:opener_id)` + + ## [0.21.0](https://github.com/rubycdp/ferrum/compare/v0.20.2...v0.21.0) (November 24, 2026) ## ### Added diff --git a/lib/ferrum/browser.rb b/lib/ferrum/browser.rb index 60689a5c..d042f843 100644 --- a/lib/ferrum/browser.rb +++ b/lib/ferrum/browser.rb @@ -27,7 +27,7 @@ class Browser extend Forwardable delegate %i[default_context] => :contexts - delegate %i[targets create_target page pages windows await_page await_page! workers service_workers + delegate %i[targets create_target page pages await_page await_page! workers service_workers attach_target cookies] => :default_context delegate %i[go_to go_to! goto go back back! forward forward! refresh refresh! reload reload! stop await_navigation await_navigation! await_download await_download! wait_until wait_until! diff --git a/lib/ferrum/context.rb b/lib/ferrum/context.rb index 6b4a9444..027aca79 100644 --- a/lib/ferrum/context.rb +++ b/lib/ferrum/context.rb @@ -11,10 +11,6 @@ module Ferrum # of contexts and routes CDP target events to the right one. # class Context - POSITION = %i[first last].freeze - WINDOWS_DEPRECATED = "windows will be removed in Ferrum 0.22. Use await_page { ... } for the page a click " \ - "opens, or pages(&:opener_id) for all of them." - attr_reader :id def initialize(client, contexts, id, implicit: false) @@ -110,29 +106,6 @@ def service_workers @targets.values.select(&:service_worker?) end - # The pages of this context opened by another page. - # - # @deprecated Will be removed in Ferrum 0.22. Use {#await_page} for the page a click opens, or - # `pages(&:opener_id)` for all of them. - # - # @param [:first, :last, nil] pos - # - # @param [Integer] size - # - # @return [Array] - # - # @raise [ArgumentError] - # - # @raise [TimeoutError] - def windows(pos = nil, size = 1) - Utils::Deprecate.warn(WINDOWS_DEPRECATED, user_code: true) - raise ArgumentError if pos && !POSITION.include?(pos) - - windows = @targets.values.select(&:opener_id) - windows = windows.send(pos, size) if pos - windows.map(&:page) - end - # Runs the block and returns the page it opens, in a tab or a window, # e.g. through `window.open` or a link with `target="_blank"`. # diff --git a/lib/ferrum/target.rb b/lib/ferrum/target.rb index 35de98a7..de99f546 100644 --- a/lib/ferrum/target.rb +++ b/lib/ferrum/target.rb @@ -9,8 +9,6 @@ module Ferrum # class Target NEW_WINDOW_WAIT = ENV.fetch("FERRUM_NEW_WINDOW_WAIT", 0.3).to_f - WINDOW_DEPRECATED = "window? will be removed in Ferrum 0.22. Use opener_id, it is set for a target another one " \ - "opened." attr_reader :options @@ -176,16 +174,6 @@ def context_id @params["browserContextId"] unless @implicit end - # Whether this target was opened by another one, i.e. has an {#opener_id}. - # - # @deprecated Will be removed in Ferrum 0.22. Use {#opener_id}. - # - # @return [Boolean] - def window? - Utils::Deprecate.warn(WINDOW_DEPRECATED, user_code: true) - !!opener_id - end - # Whether this target is an iframe. # # @return [Boolean] diff --git a/sig/ferrum/context.rbs b/sig/ferrum/context.rbs index 2e38c1c0..db0c323f 100644 --- a/sig/ferrum/context.rbs +++ b/sig/ferrum/context.rbs @@ -1,8 +1,5 @@ module Ferrum class Context - POSITION: ::Array[:first | :last] - WINDOWS_DEPRECATED: String - attr_reader id: String def targets: () -> Hash[String, Target] @@ -33,8 +30,6 @@ module Ferrum def service_workers: () -> ::Array[Target] - %a{deprecated} def windows: (?(:first | :last)?, ?::Integer) -> ::Array[Page] - def await_page: (?opener: Page?, ?timeout: (::Numeric | Deadline)?) { () -> void } -> Page? def await_page!: (?opener: Page?, ?timeout: (::Numeric | Deadline)?) { () -> void } -> Page diff --git a/sig/ferrum/target.rbs b/sig/ferrum/target.rbs index 02638ad4..2e901a0b 100644 --- a/sig/ferrum/target.rbs +++ b/sig/ferrum/target.rbs @@ -1,7 +1,6 @@ module Ferrum class Target NEW_WINDOW_WAIT: ::Float - WINDOW_DEPRECATED: String attr_writer page: Page? attr_reader options: Browser::Options @@ -48,8 +47,6 @@ module Ferrum def context_id: () -> String? - %a{deprecated} def window?: () -> bool - def iframe?: () -> bool def page?: () -> bool diff --git a/spec/context_spec.rb b/spec/context_spec.rb index d0bc9f90..68db15ad 100644 --- a/spec/context_spec.rb +++ b/spec/context_spec.rb @@ -155,26 +155,6 @@ end end - describe "#windows" do - around do |example| - Ferrum::Utils::Deprecate.reset! - example.run - Ferrum::Utils::Deprecate.reset! - end - - it "returns the pages opened by another page and warns that it is deprecated" do - browser.go_to - popup = browser.await_page { browser.execute(%(window.open("/simple", "popup"))) } - - windows = nil - expect { windows = browser.windows } - .to output(/windows will be removed in Ferrum 0\.22.*called from #{__FILE__}/m).to_stderr - expect(windows).to eq([popup]) - ensure - popup&.close - end - end - describe "#await_page" do it "returns the page opened with window.open" do browser.go_to diff --git a/spec/target_spec.rb b/spec/target_spec.rb index c6326860..b657e290 100644 --- a/spec/target_spec.rb +++ b/spec/target_spec.rb @@ -105,23 +105,6 @@ def register_service_worker end end - describe "#window?" do - around do |example| - Ferrum::Utils::Deprecate.reset! - example.run - Ferrum::Utils::Deprecate.reset! - end - - it "returns true for a target another one opened and warns that it is deprecated" do - target = open_popup - - window = nil - expect { window = target.window? } - .to output(/window\? will be removed in Ferrum 0\.22.*called from #{__FILE__}/m).to_stderr - expect(window).to be(true) - end - end - describe "#page?" do it "returns true for a page" do expect(target_of(page)).to be_page From af9d756f2cd1e577797413fa524af244af61f991 Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Tue, 24 Nov 2026 15:58:23 +0300 Subject: [PATCH 02/15] ref(options)!: remove :js_errors, :pending_connection_errors and PendingConnectionsError --- CHANGELOG.md | 2 + docs/2-customization.md | 5 --- lib/ferrum/browser.rb | 10 ----- lib/ferrum/browser/options.rb | 17 +------- lib/ferrum/errors.rb | 17 -------- lib/ferrum/page.rb | 7 ---- lib/ferrum/page/navigation.rb | 6 +-- lib/ferrum/worker.rb | 7 ---- sig/ferrum/browser/options.rbs | 9 ---- sig/ferrum/errors.rbs | 6 --- spec/browser_spec.rb | 12 ------ spec/frame/runtime_spec.rb | 75 ---------------------------------- 12 files changed, 4 insertions(+), 169 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0394a94e..814616fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ ### Removed - `target.window?` and `windows` of a context and of the browser, use `target.opener_id`, `await_page { ... }` or `pages(&:opener_id)` +- `:js_errors`, uncaught exceptions are in `page.console` with `source: :exception`, and `page.on(:console)` yields them +- `:pending_connection_errors` and `PendingConnectionsError`, use `go_to!`, it raises `NavigationTimeoutError` ## [0.21.0](https://github.com/rubycdp/ferrum/compare/v0.20.2...v0.21.0) (November 24, 2026) ## diff --git a/docs/2-customization.md b/docs/2-customization.md index 890371b2..73819a47 100644 --- a/docs/2-customization.md +++ b/docs/2-customization.md @@ -32,11 +32,6 @@ Ferrum::Browser.new(options) commands, like `evaluate` or `at_css`, waits for the browser's answer. A call that runs out raises `Ferrum::TimeoutError`. Pass `timeout:` to `go_to`, `refresh` or `await_navigation` to change it for one call, or wrap calls in `Ferrum::Deadline.within` to bound them together, see [Timeouts](#timeouts). - * `:js_errors` (Boolean) - Deprecated, will be removed in 0.22. When true, JavaScript errors get re-raised in - Ruby. Uncaught exceptions are in the [console](/docs/ferrum/javascript#console), use - `page.console.select { |m| m.source == :exception }` or `page.on(:console)` instead. - * `:pending_connection_errors` (Boolean) - Deprecated, will be removed in 0.22. Use `page.go_to!(url)` to raise - when the page doesn't load in time. * `:browser_path` (String) - Path to Chrome binary, or to an Opera or Edge one, you can also set ENV variable as `BROWSER_PATH=some/path/chrome bundle exec rspec`. * `:browser_options` (Hash) - Additional command line options, diff --git a/lib/ferrum/browser.rb b/lib/ferrum/browser.rb index d042f843..b984d5b9 100644 --- a/lib/ferrum/browser.rb +++ b/lib/ferrum/browser.rb @@ -98,16 +98,6 @@ class Browser # `FERRUM_DEFAULT_TIMEOUT` sets the default. Pass `timeout:` to `go_to`, `refresh` or `await_navigation` to # change it for one call, or wrap calls in {Deadline.within} to bound them together. # - # @option options [Boolean] :js_errors - # Deprecated, will be removed in Ferrum 0.22. When true, JavaScript - # errors get re-raised in Ruby. Uncaught exceptions are in the console, - # use `page.console.select { |m| m.source == :exception }` or - # `page.on(:console)` instead. - # - # @option options [Boolean] :pending_connection_errors (false) - # Deprecated, will be removed in Ferrum 0.22. Makes `go_to` raise - # {PendingConnectionsError} on timeout, use `go_to!` instead. - # # @option options [String] :browser_path # Path to Chrome binary, you can also set ENV variable as # `BROWSER_PATH=some/path/chrome bundle exec rspec`. diff --git a/lib/ferrum/browser/options.rb b/lib/ferrum/browser/options.rb index cde5062d..e1d52528 100644 --- a/lib/ferrum/browser/options.rb +++ b/lib/ferrum/browser/options.rb @@ -29,7 +29,7 @@ class Options end attr_reader :window_size, :logger, :log, :ws_max_receive_size, - :js_errors, :base_url, :slowmo, :pending_connection_errors, + :base_url, :slowmo, :url, :ws_url, :env, :process_timeout, :browser_path, :save_path, :proxy, :port, :host, :headless, :incognito, :dockerize, :browser_options, :ignore_default_browser_options, :xvfb, :flatten, :extensions @@ -43,19 +43,11 @@ def initialize(options = nil) @timeout = @options.fetch(:timeout, DEFAULT_TIMEOUT) warn_protocol_timeout if @options.key?(:protocol_timeout) @window_size = @options.fetch(:window_size, WINDOW_SIZE) - @js_errors = fetch_deprecated( - :js_errors, - "Uncaught exceptions are in the console, use page.console.select { |m| m.source == :exception } " \ - "or page.on(:console)." - ) @headless = @options.fetch(:headless, true) @incognito = @options.fetch(:incognito, true) @dockerize = @options.fetch(:dockerize, false) @flatten = @options.fetch(:flatten, true) warn_flatten unless @flatten - @pending_connection_errors = fetch_deprecated( - :pending_connection_errors, "Use page.go_to!(url) to raise when the page doesn't load in time." - ) @process_timeout = @options.fetch(:process_timeout, PROCESS_TIMEOUT) @slowmo = @options[:slowmo].to_f @@ -179,13 +171,6 @@ def warn_flatten ) end - def fetch_deprecated(name, instead) - return false unless @options.key?(name) - - Utils::Deprecate.warn(":#{name} will be removed in Ferrum 0.22. #{instead}", user_code: true) - @options[name] - end - def read_extension(extension) (extension.is_a?(Hash) && extension[:source]) || File.read(extension) end diff --git a/lib/ferrum/errors.rb b/lib/ferrum/errors.rb index bd9788c3..ca87473c 100644 --- a/lib/ferrum/errors.rb +++ b/lib/ferrum/errors.rb @@ -22,23 +22,6 @@ def initialize(url, message = nil) end end - # Raised when the request reached the server, but the page still has - # pending network connections that never settled. - # - # @deprecated Will be removed in Ferrum 0.22 with the `:pending_connection_errors` - # option. `go_to!` raises {NavigationTimeoutError}. - class PendingConnectionsError < StatusError - attr_reader :pendings - - def initialize(url, pendings = []) - @pendings = pendings - message = "Request to #{url} reached server, but there are still pending connections" - message += ": #{pendings.join(', ')}" unless @pendings.empty? - - super(url, message) - end - end - # Raised when waiting for a response from the browser times out. class TimeoutError < Error # The CDP method that didn't answer in time, `nil` when the wait wasn't for a command. diff --git a/lib/ferrum/page.rb b/lib/ferrum/page.rb index 7d864f95..b62aad62 100644 --- a/lib/ferrum/page.rb +++ b/lib/ferrum/page.rb @@ -609,13 +609,6 @@ def subscribe on("DOM.documentUpdated") { @document_version += 1 } - if @options.js_errors - on("Runtime.exceptionThrown") do |params| - # FIXME: https://jvns.ca/blog/2015/11/27/why-rubys-timeout-is-dangerous-and-thread-dot-raise-is-terrifying/ - Thread.main.raise JavaScriptError, params["exceptionDetails"] - end - end - chain(:dialog) end diff --git a/lib/ferrum/page/navigation.rb b/lib/ferrum/page/navigation.rb index 3745ec11..9f4b45a4 100644 --- a/lib/ferrum/page/navigation.rb +++ b/lib/ferrum/page/navigation.rb @@ -33,9 +33,6 @@ module Navigation # @raise [NavigationTimeoutError] # Once the budget of an enclosing {Deadline.within} is used up. # - # @raise [PendingConnectionsError] - # If the deprecated `:pending_connection_errors` option is set and the page doesn't load in time. - # # @example # page.go_to("https://github.com/") # page.go_to("/slow", timeout: 10) @@ -43,8 +40,7 @@ module Navigation # def go_to(url = nil, timeout: nil, referrer: nil) go_to!(url, timeout: timeout, referrer: referrer) - rescue NavigationTimeoutError => e - raise PendingConnectionsError.new(e.url, e.pendings) if @options.pending_connection_errors + rescue NavigationTimeoutError raise if Deadline.current&.expired? nil diff --git a/lib/ferrum/worker.rb b/lib/ferrum/worker.rb index 11eb45e4..6209656b 100644 --- a/lib/ferrum/worker.rb +++ b/lib/ferrum/worker.rb @@ -117,13 +117,6 @@ def subscribe on("Runtime.executionContextCreated") do |params| self.execution_id = params.dig("context", "id") end - - return unless @options.js_errors - - on("Runtime.exceptionThrown") do |params| - # FIXME: https://jvns.ca/blog/2015/11/27/why-rubys-timeout-is-dangerous-and-thread-dot-raise-is-terrifying/ - Thread.main.raise JavaScriptError, params["exceptionDetails"] - end end def prepare diff --git a/sig/ferrum/browser/options.rbs b/sig/ferrum/browser/options.rbs index 2385dea1..1b90876f 100644 --- a/sig/ferrum/browser/options.rbs +++ b/sig/ferrum/browser/options.rbs @@ -30,14 +30,10 @@ module Ferrum attr_reader ws_max_receive_size: ::Integer? - %a{deprecated} attr_reader js_errors: bool - attr_reader base_url: ::Addressable::URI? attr_reader slowmo: ::Float - %a{deprecated} attr_reader pending_connection_errors: bool - attr_reader url: String? attr_reader ws_url: String? @@ -46,7 +42,6 @@ module Ferrum attr_reader process_timeout: ::Integer - attr_reader browser_path: String? attr_reader save_path: String? @@ -74,11 +69,9 @@ module Ferrum @host: String @timeout: ::Numeric @window_size: ::Array[::Integer] - @js_errors: bool @headless: bool @incognito: bool @flatten: bool - @pending_connection_errors: bool @process_timeout: ::Integer @slowmo: ::Float @env: Hash[String, String]? @@ -115,8 +108,6 @@ module Ferrum def warn_flatten: () -> void - def fetch_deprecated: (Symbol name, String instead) -> bool - def read_extension: (String | Hash[Symbol, String] extension) -> String def parse_logger: (untyped logger) -> [untyped, Log?] diff --git a/sig/ferrum/errors.rbs b/sig/ferrum/errors.rbs index 5c1d3755..dfb3deba 100644 --- a/sig/ferrum/errors.rbs +++ b/sig/ferrum/errors.rbs @@ -21,12 +21,6 @@ module Ferrum def initialize: (String url, ?String? message) -> void end - %a{deprecated} class PendingConnectionsError < StatusError - attr_reader pendings: ::Array[String] - - def initialize: (String url, ?::Array[String] pendings) -> void - end - class NavigationTimeoutError < TimeoutError attr_reader url: String? attr_reader pendings: ::Array[String] diff --git a/spec/browser_spec.rb b/spec/browser_spec.rb index fb9bda25..5aebe35f 100644 --- a/spec/browser_spec.rb +++ b/spec/browser_spec.rb @@ -535,18 +535,6 @@ def proxy_tunnel(socket, request, browser_url) browser&.quit end - it "supports deprecated :pending_connection_errors argument", :launch do - Ferrum::Utils::Deprecate.reset! - browser = nil - - expect { browser = Ferrum::Browser.new(base_url: base_url, pending_connection_errors: true, timeout: 0.5) } - .to output(/:pending_connection_errors will be removed in Ferrum 0\.22.*called from #{__FILE__}/m).to_stderr - expect { browser.go_to("/really_slow") }.to raise_error(Ferrum::PendingConnectionsError) - ensure - browser&.quit - Ferrum::Utils::Deprecate.reset! - end - it "stops process if an error is raised during process start", :launch do process = Ferrum::Browser::Process.new(Ferrum::Browser::Options.new(process_timeout: 0)) allow(Ferrum::Browser::Process).to receive(:new).and_return(process) diff --git a/spec/frame/runtime_spec.rb b/spec/frame/runtime_spec.rb index 260275fa..f2f6ef8c 100644 --- a/spec/frame/runtime_spec.rb +++ b/spec/frame/runtime_spec.rb @@ -23,81 +23,6 @@ expect(browser.evaluate("[window.i, window.ran]")).to eq([3, true]) expect(browser.evaluate("a + 1;", a: 1)).to eq(2) end - - context "with javascript errors" do - let(:browser) { Ferrum::Browser.new(base_url: base_url, js_errors: true) } - - before { allow(Ferrum::Utils::Deprecate).to receive(:warn) } - - after { browser.quit } - - it "warns that :js_errors is deprecated", :launch do - Ferrum::Utils::Deprecate.reset! - allow(Ferrum::Utils::Deprecate).to receive(:warn).and_call_original - - expect { browser }.to output(/:js_errors will be removed in Ferrum 0\.22.*called from #{__FILE__}/m).to_stderr - ensure - Ferrum::Utils::Deprecate.reset! - end - - it "propagates a Javascript error to a ruby exception", :launch do - expect do - browser.execute(%(throw new Error("zomg"))) - end.to raise_error(Ferrum::JavaScriptError) { |e| - expect(e.message).to include("Error: zomg") - } - end - - it "propagates an asynchronous Javascript error on the page to a ruby exception", :launch do - expect do - browser.execute "setTimeout(function() { omg }, 0)" - sleep 0.01 - browser.execute "" - end.to raise_error(Ferrum::JavaScriptError, /ReferenceError.*omg/) - end - - it "propagates a synchronous Javascript error on the page to a ruby exception", :launch do - expect do - browser.execute "omg" - end.to raise_error(Ferrum::JavaScriptError, /ReferenceError.*omg/) - end - - it "does not re-raise a Javascript error if it is rescued", :launch do - expect do - browser.execute "setTimeout(function() { omg }, 0)" - sleep 0.01 - browser.execute "" - end.to raise_error(Ferrum::JavaScriptError, /ReferenceError.*omg/) - - # should not raise again - expect(browser.evaluate("1+1")).to eq(2) - end - - it "propagates a Javascript error during page load to a ruby exception", :launch do - expect { browser.go_to("/js_error") }.to raise_error(Ferrum::JavaScriptError) - end - - it "does not propagate a Javascript error to ruby if error raising disabled", :launch do - browser = Ferrum::Browser.new(base_url: base_url, js_errors: false) - browser.go_to("/js_error") - browser.execute "setTimeout(function() { omg }, 0)" - sleep 0.1 - expect(browser.html).to include("hello") - ensure - browser&.quit - end - - it "does not propagate a Javascript error to ruby if error raising disabled and client restarted", :launch do - browser = Ferrum::Browser.new(base_url: base_url, js_errors: false) - browser.restart - browser.go_to("/js_error") - browser.execute "setTimeout(function() { omg }, 0)" - sleep 0.1 - expect(browser.html).to include("hello") - ensure - browser&.quit - end - end end describe "#evaluate" do From 915c64e399e4c852fb490b0e0a5bc7a0896ad1cc Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Tue, 24 Nov 2026 15:58:23 +0300 Subject: [PATCH 03/15] ref(frame)!: remove current_url and current_title --- CHANGELOG.md | 2 ++ docs/15-frames.md | 3 +-- docs/4-finders.md | 2 -- lib/ferrum/browser.rb | 2 +- lib/ferrum/frame/dom.rb | 38 -------------------------------------- lib/ferrum/page.rb | 2 +- sig/ferrum/frame/dom.rbs | 4 ---- spec/frame/dom_spec.rb | 34 ---------------------------------- 8 files changed, 5 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 814616fc..7c26785f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ `pages(&:opener_id)` - `:js_errors`, uncaught exceptions are in `page.console` with `source: :exception`, and `page.on(:console)` yields them - `:pending_connection_errors` and `PendingConnectionsError`, use `go_to!`, it raises `NavigationTimeoutError` +- `current_url` and `current_title` of pages and frames, use `url` and `title`, or `frame.page.url` for the top window + from a frame ## [0.21.0](https://github.com/rubycdp/ferrum/compare/v0.20.2...v0.21.0) (November 24, 2026) ## diff --git a/docs/15-frames.md b/docs/15-frames.md index edc0cb46..29fbf7a3 100644 --- a/docs/15-frames.md +++ b/docs/15-frames.md @@ -122,8 +122,7 @@ frame.main? # => false #### page : `Page` -The page the frame belongs to, use `frame.page.url` and `frame.page.title` for the top window. `current_url` and -`current_title` are deprecated and will be removed in 0.22. +The page the frame belongs to, use `frame.page.url` and `frame.page.title` for the top window. ```ruby page.go_to("https://www.w3schools.com/tags/tag_frame.asp") diff --git a/docs/4-finders.md b/docs/4-finders.md index d635b3f9..f16d89e4 100644 --- a/docs/4-finders.md +++ b/docs/4-finders.md @@ -95,8 +95,6 @@ page.go_to("https://google.com/") page.title # => "Google" ``` -`current_url` and `current_title` are deprecated and will be removed in 0.22, use `url` and `title`. - #### html : `String` Returns the HTML of the whole document, `` included. `body` is deprecated and will be removed in 0.22, it never diff --git a/lib/ferrum/browser.rb b/lib/ferrum/browser.rb index b984d5b9..25c3e614 100644 --- a/lib/ferrum/browser.rb +++ b/lib/ferrum/browser.rb @@ -33,7 +33,7 @@ class Browser await_navigation await_navigation! await_download await_download! wait_until wait_until! wait_for_reload wait_for_navigation wait_for_navigation! at_css at_xpath css xpath wait_css wait_css! wait_xpath wait_xpath! wait_for_selector - current_url current_title url title + url title html body doctype content= headers network console accessibility downloads tracing mouse keyboard diff --git a/lib/ferrum/frame/dom.rb b/lib/ferrum/frame/dom.rb index f7321d70..cc129b42 100644 --- a/lib/ferrum/frame/dom.rb +++ b/lib/ferrum/frame/dom.rb @@ -64,44 +64,6 @@ module DOM } JS - # - # @deprecated Will be removed in Ferrum 0.22. Use `page.url`, or - # `frame.page.url` from a frame. - # - # Returns current top window `location href`. - # - # @return [String] - # The window's current URL. - # - # @raise [TimeoutError] - # - def current_url - Utils::Deprecate.warn( - "#current_url will be removed in Ferrum 0.22. Use page.url, or frame.page.url from a frame, " \ - "frame.url is the frame's own URL." - ) - evaluate("window.top.location.href") - end - - # - # @deprecated Will be removed in Ferrum 0.22. Use `page.title`, or - # `frame.page.title` from a frame. - # - # Returns current top window title. - # - # @return [String] - # The window's current title. - # - # @raise [TimeoutError] - # - def current_title - Utils::Deprecate.warn( - "#current_title will be removed in Ferrum 0.22. Use page.title, or frame.page.title from a frame, " \ - "frame.title is the frame's own title." - ) - evaluate("window.top.document.title") - end - # # Returns current document's doctype declaration. # diff --git a/lib/ferrum/page.rb b/lib/ferrum/page.rb index b62aad62..e2a13aad 100644 --- a/lib/ferrum/page.rb +++ b/lib/ferrum/page.rb @@ -42,7 +42,7 @@ class Page extend Forwardable delegate %i[at_css at_xpath css xpath wait_css wait_css! wait_xpath wait_xpath! wait_for_selector - current_url current_title url title html body doctype content= + url title html body doctype content= execution_id execution_id! evaluate evaluate_handle execute isolated_world add_script_tag add_style_tag] => :main_frame delegate %i[await_download await_download!] => :downloads diff --git a/sig/ferrum/frame/dom.rbs b/sig/ferrum/frame/dom.rbs index 1862623d..dcabb17a 100644 --- a/sig/ferrum/frame/dom.rbs +++ b/sig/ferrum/frame/dom.rbs @@ -11,10 +11,6 @@ module Ferrum LINK_TAG: ::String - %a{deprecated} def current_url: () -> untyped - - %a{deprecated} def current_title: () -> untyped - def doctype: () -> untyped def html: () -> String diff --git a/spec/frame/dom_spec.rb b/spec/frame/dom_spec.rb index adefb8e5..fb60e1b5 100644 --- a/spec/frame/dom_spec.rb +++ b/spec/frame/dom_spec.rb @@ -71,40 +71,6 @@ end end - describe "#current_url" do - around do |example| - Ferrum::Utils::Deprecate.reset! - example.run - Ferrum::Utils::Deprecate.reset! - end - - it "returns the top window's url and warns that it is deprecated" do - page.go_to - page.execute(%(document.body.innerHTML += "