I am working with a js heavy webpage and I have a div element which looks like so:
<div id="results-ItemSearch" class="itemresults" onscroll="loadMoreItems(event)">
....
</div>
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:
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
however, when I do this on this webpage, I get a selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable exception.
I tried selecting by css, but that does not yield anything either. I also tried waiting for 15 or so seconds for complete load, but that does not seem to work either.
Thus, I was wondering if there is a way to directly excecute the JS loadMoreItems(event) via selenium.
Any help will be appreciated - spent 4 hours on this now!
driver.execute_script("arguments[0].scrollIntoView(true);", someElement)? You could locate the 'last' item inside youritemresultslist, and scroll to it this way -- this should ideally triggerloadMoreItems(event).