I came across this situation, I need to scroll through the instagram comments to the end, but only this code works for Selenium:
driver.execute_script("arguments[0].scrollTop = arguments[0].scrollHeight", window)
But I need to make sure that the comments scroll to the end, and this method scrolls them only at the beginning. You also need to consider uploading comments. It is also important to clarify that there is no end element for which the script can be stopped.