diff --git a/lib/capybara/apparition/page.rb b/lib/capybara/apparition/page.rb index 50f24ae..e4607a3 100644 --- a/lib/capybara/apparition/page.rb +++ b/lib/capybara/apparition/page.rb @@ -157,7 +157,7 @@ def render(options) %w[x y width height].each_with_object({}) { |key, hash| hash[key] = pos[key] } elsif options[:full] evaluate <<~JS - { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight} + { width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight} JS else evaluate <<~JS @@ -165,6 +165,7 @@ def render(options) JS end options[:clip] = { x: 0, y: 0, scale: scale }.merge(clip_options) + options[:captureBeyondViewport] = true command('Page.captureScreenshot', **options) end['data'] end diff --git a/spec/integration/driver_spec.rb b/spec/integration/driver_spec.rb index 06861ea..873142a 100644 --- a/spec/integration/driver_spec.rb +++ b/spec/integration/driver_spec.rb @@ -169,7 +169,7 @@ def session_url(path) create_screenshot file, full: true expect(FastImage.size(file)).to eq( - @driver.evaluate_script('[document.documentElement.clientWidth, document.documentElement.clientHeight]') + @driver.evaluate_script('[document.documentElement.scrollWidth, document.documentElement.scrollHeight]') ) end @@ -203,7 +203,7 @@ def session_url(path) create_screenshot file, full: true, selector: '#penultimate' expect(FastImage.size(file)).to eq( - @driver.evaluate_script('[document.documentElement.clientWidth, document.documentElement.clientHeight]') + @driver.evaluate_script('[document.documentElement.scrollWidth, document.documentElement.scrollHeight]') ) end