docs: function simulateScreenshot(driver, w, h, browserName) {
    var scrollPos;
    var isRetina;
    var rawImageString;
  
    return browser
      .executeScript(driver, hideScrollbarScript + infoScript)
      .then(function(info) {
        scrollPos = info.slice(0, 4);
        isRetina = info[4];
        return browser.takeScreenshot(driver);
      })
      .then(function(res) {
        rawImageString = res;
        return browser.executeScript(driver, showScrollbarScript);
      })
      .then(function() {
        var left = Math.min(scrollPos[0], scrollPos[2] - w);
        var top = Math.min(scrollPos[1], scrollPos[3] - h);
  
        var config = {
          left: left < 0 ? 0 : left,
          top: top < 0 ? 0 : top,
          width: w,
          height: h,
        };
  
        if (browserName === 'chrome') {
          // chrome already takes partial ss. Browser size is adjusted correctly
          // except for width. If it's retina then instead of cropping w, we need
          // to crop w * 2. FF still takes the right dimensions regardless of
          // retina-ness so nothing to adjust here.
          config = {
            left: 0,
            top: 0,
            width: isRetina ? w * 2 : w,
            height: 99999,
          };
        }
        var buf = new Buffer(rawImageString, 'base64');
  
        return cropP(buf, config);
      });
  }