diff --git a/lib/ferrum/browser.rb b/lib/ferrum/browser.rb index 646f8af4..59f58935 100644 --- a/lib/ferrum/browser.rb +++ b/lib/ferrum/browser.rb @@ -28,10 +28,10 @@ class Browser add_script_tag add_style_tag bypass_csp on position position= playback_rate playback_rate= - disable_javascript set_viewport] => :page + disable_javascript set_viewport resize] => :page delegate %i[default_user_agent] => :process - attr_reader :client, :process, :contexts, :options, :window_size, :base_url + attr_reader :client, :process, :contexts, :options, :base_url attr_accessor :timeout # @@ -126,7 +126,6 @@ def initialize(options = nil) @client = @process = @contexts = nil @timeout = @options.timeout - @window_size = @options.window_size @base_url = @options.base_url if @options.base_url start @@ -228,7 +227,6 @@ def command(*args) # browser.quit # def reset - @window_size = options.window_size contexts.reset end @@ -245,11 +243,6 @@ def quit @client = @process = @contexts = nil end - def resize(**options) - @window_size = [options[:width], options[:height]] - page.resize(**options) - end - def crash command("Browser.crash") end diff --git a/lib/ferrum/browser/options/chrome.rb b/lib/ferrum/browser/options/chrome.rb index 6a15b5a6..dc5903cf 100644 --- a/lib/ferrum/browser/options/chrome.rb +++ b/lib/ferrum/browser/options/chrome.rb @@ -64,7 +64,6 @@ class Chrome < Base def merge_required(flags, options, user_data_dir) flags = flags.merge("remote-debugging-port" => options.port, "remote-debugging-address" => options.host, - # Doesn't work on MacOS, so we need to set it by CDP "window-size" => options.window_size&.join(","), "user-data-dir" => user_data_dir) diff --git a/lib/ferrum/page.rb b/lib/ferrum/page.rb index 0e34ff23..86289786 100644 --- a/lib/ferrum/page.rb +++ b/lib/ferrum/page.rb @@ -404,9 +404,6 @@ def prepare_page inject_extensions - width, height = @browser.window_size - resize(width: width, height: height) - response = command("Page.getNavigationHistory") transition_type = response.dig("entries", 0, "transitionType") return if transition_type == "auto_toplevel" diff --git a/spec/browser_spec.rb b/spec/browser_spec.rb index 758623ef..8ba533ce 100644 --- a/spec/browser_spec.rb +++ b/spec/browser_spec.rb @@ -353,13 +353,6 @@ expect(browser.viewport_size).to eq([200, 400]) end - it "inherits size for a new window" do - browser.go_to - browser.resize(width: 1200, height: 800) - page = browser.create_page - expect(page.viewport_size).to eq [1200, 800] - end - it "resizes windows" do browser.go_to