title: How to scroll an overflowing div inside a web page
body: <p>Is there a way to scroll the scrollbar of a div inside a web page? To be more exact, I'm trying to automate the scrolling of up and down of an instagram post e.g <a href="https://instagram.com/p/9D5Ir3CY3D/?taken-by=bentomonsters" rel="nofollow">https://instagram.com/p/9D5Ir3CY3D/?taken-by=bentomonsters</a>. However, as the scrollbar might be hidden using CSS property, I might not be able to detect it as the scrollbar is not an element.</p>
  
  <p>Below is the css style (from firebug) of the scrollbar.</p>
  
  <pre><code>.-cx-PRIVATE-PostInfo__comments {
      margin-left: -24px;
      margin-right: -24px;
      margin-top: -5px;
      padding-left: 24px;
      padding-right: 24px;
      padding-top: 5px;
  }
  .-cx-PRIVATE-PostInfo__commentsSidebarVariant {
      overflow: auto;
      padding-bottom: 20px;
  } 
  .-cx-PRIVATE-PostInfo__comments {
      flex-grow: 1;
  }
  ol, ul {
      list-style: outside none none;
  }
  html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, 
  blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, 
  img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, 
  center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, 
  tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, 
  figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, 
  time, mark, audio, video {
      border: 0 none;
      font: inherit;
      margin: 0;
      padding: 0;
      vertical-align: baseline;
  }
  </code></pre>
  
  <p>I have tried ways such as </p>
  
  <pre><code>WebElement commentscroll = dr.findElement(By.className("commentsSidebarVariant"));
  
  jse.executeScript("return arguments[0].scrollTop;", commentscroll);
  
  jse.executeScript("$(\"#commentsSidebarVariant\").animate({ scrollTop: \"100px\" })");  
  
  jse.executeScript("arguments[0].scrollTop = arguments[1];", commentscroll);
  
  WebElement commentscroll = dr.findElement(By.cssSelector(".-cx-PRIVATE-PostInfo__commentsSidebarVariant"));               
  
  jse.executeScript("arguments[0].scrollTop;", commentscroll);
  </code></pre>
  
  <p>and none of them works as the scrollbar does not even move.</p>