code: public void scroll(int desiredPosition) {
          String action = "Scrolling page by " + desiredPosition + " pixels";
          String expected = "Page is scrolled down " + desiredPosition + " pixels";
          Long newPosition;
          try {
              JavascriptExecutor jse = (JavascriptExecutor) driver;
              Long initialPosition = (Long) jse.executeScript("return window.scrollY;");
  
              action = "Scrolling page from " + initialPosition + " to " + desiredPosition;
              expected = "Page is now set at position " + desiredPosition;
  
              jse.executeScript("window.scrollBy(0, " + desiredPosition + ")");
  
              newPosition = (Long) jse.executeScript("return window.scrollY;");
          } catch (Exception e) {
              reporter.fail(action, expected, "Unable to scroll on the page. " + e.getMessage());
              log.warn(e);
              return;
          }
          if (newPosition != desiredPosition) {
              reporter.fail(action, expected, "Page is set at position " + newPosition);
              return; // indicates page didn't scroll properly
          }
          reporter.pass(action, expected, "Page is now set at position " + newPosition);
      }
docs: An custom script to scroll to a given position on the page, using
  javascript. If the browser being used doesn't support javascript, or the
  page isn't long enough to support scrolling to the desired position, than
  an error will be logged and recorded
  
  @param desiredPosition - the position on the page to scroll to