title: python selenium execute onscroll javascript
body: <p>I am working with a js heavy webpage and I have a <code>div</code> element which looks like so:</p>
  
  <pre><code>&lt;div id="results-ItemSearch" class="itemresults" onscroll="loadMoreItems(event)"&gt;
  ....
  &lt;/div&gt;
  </code></pre>
  
  <p>It is one of those webpages which does autoscrolling (further complicated by the fact that there are three panes within the same window and I am having a hard time getting to the pane I want to work with), and normally, I implement something like this in selenium:</p>
  
  <pre><code>no_of_pagedowns = 1
  while no_of_pagedowns:
      browser.find_element_by_xpath('/html/body').send_keys(Keys.PAGE_DOWN)
      time.sleep(1)
      no_of_pagedowns-=1
  </code></pre>
  
  <p>however, when I do this on this webpage, I get a <code>selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable</code> exception.</p>
  
  <p>I tried selecting by css, but that does not yield anything either. I also tried <code>waiting</code> for 15 or so seconds for complete load, but that does not seem to work either.</p>
  
  <p>Thus, I was wondering if there is a way to directly excecute the JS <code>loadMoreItems(event)</code> via selenium.</p>
  
  <p>Any help will be appreciated - spent 4 hours on this now!</p>