'Trigger some JavaScript function with selenium on a webpage to load new elements

I'm trying to get some data from a webpage:

https://www.cabotcorp.com/solutions#product-index

On this webpage, whenever you scroll down to the end, it takes a couple of seconds and then loads a new set of items.

When that happens something gets added to the HTML which I want to look at with selenium in python.

So my question is pretty general:

Is there a way to force the function that loads the new elements?

My first idea is as follows:

driver.execute_script("arguments[0].scrollIntoView();", driver.find_element(By.CLASS_NAME, "some class at the bottom of the page"))

This is the code I would use to let selenium scroll down to some element on the webpage. After that I would just sleep for a set amount of time to assure that the new elements loaded in.

However, I noticed that this webpage uses "ddscrollspy"

https://github.com/dynamicdriverepo/ddscrollspy

Is there a way to use selenium to trigger a new set of items? I'm basically looking for a function that triggers certain Javascripts that are available on a certain webpage.

Edit:

A friend suggested looking for triggers:

This is what I found in Chrome:

enter image description here

So I now have access to the code that gets executed whenever something new loads. Now I just need to know how to trigger that code on demand.

Thanks for the help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source