A
A
agent_22032021-02-11 12:35:09
Python
agent_2203, 2021-02-11 12:35:09

How to scroll an element to the end?

There is the following code:

def scroll_to_down(self):
        print("Скролим вниз")
        lastHeight = self.driver.execute_script("return document.body.scrollHeight")
        while True:
            self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
            sleep(3)
            newHeight = self.driver.execute_script("return document.body.scrollHeight")
            if newHeight == lastHeight:
                break


however, the problem is that on the page you need to rotate not document.body, but document.body.div (class app), how can you specify this in js ? Or maybe you have another example of how to implement this ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question