code: public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout, boolean useDevicePixelRatio) {
          Browser browser = new Browser(driver, useDevicePixelRatio);
          browser.setScrollTimeout(scrollTimeout);
  
          PageSnapshot pageScreenshot = new PageSnapshot(driver, browser.getDevicePixelRatio());
          switch (scroll) {
              case VIEWPORT_ONLY:
                  pageScreenshot.setImage(browser.takeScreenshot());
                  break;
              case WHOLE_PAGE:
                  pageScreenshot.setImage(browser.takeScreenshotEntirePage());
                  break;
          }
          return pageScreenshot;
      }
docs: To be used when screen shooting the page
  and need to scroll while making screen shots, either vertically or
  horizontally or both directions (Chrome).
  
  @param driver WebDriver instance
  @param scroll ScrollStrategy How you need to scroll
  @param  scrollTimeout Timeout to wait after scrolling and before taking screen shot
  @param useDevicePixelRatio whether or not take into account device pixel ratio
  @return PageSnapshot instance