1
votes

I want to capture full webpage screenshot in chrome browser using ruby selenium. I am using Rspec testing framework. save_screenshot method captures screenshot only for visible area. I have gone through the following link,

How to take a screenshot of a full browser page and its elements using selenium-webdriver/capybara in Ruby?

But I don't want to use window resizing or watir gem. Is there any other way or gem to achieve same.

1
not sure it helps you but IE driver is actually good for this. It'll take the whole page as screenshot.pcalkins
Thanks @Grzegorz, I will check this out.Tapas Mahato
@TapasMahato you can use gem for save screenshot - github.com/mattheworiordan/…, where you can change preferences for size screenshot.Vitalii

1 Answers

0
votes

1) You can use https://github.com/samnissen/watir-screenshot-stitch where

  • Directly employing geckodriver's new full page screenshot functionality (only on Firefox).
  • Screenshot stitching, paging down a given URL by the size of the viewport, capturing screenshots and adjoining them.
  • Employing a bundled html2canvas script against the page to generate a png from a canvas element.

2) or use native instrument for your OS - https://paulhammond.org/webkit2png
In code will look like this
webkit2png https://stackguides.com/questions/60728482/can-anyone-suggest-how-to-take-screenshot-of-full-webpage-using-ruby-selenium

where:
- main command - webkit2png
- link page - all else