Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to scroll down to end of page in selenium python

SCROLL_PAUSE_TIME = 0.5

# Get scroll height
last_height = driver.execute_script("return document.body.scrollHeight")

while True:
    # Scroll down to bottom
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

    # Wait to load page
    time.sleep(SCROLL_PAUSE_TIME)

    # Calculate new scroll height and compare with last scroll height
    new_height = driver.execute_script("return document.body.scrollHeight")
    if new_height == last_height:
        break
    last_height = new_height
Comment

PREVIOUS NEXT
Code Example
Python :: pygame.rect parameters 
Python :: how to find geometric mean in python 
Python :: ERROR: character with byte sequence 0xd0 0x9f in encoding "UTF8" has no equivalent in encoding "LATIN1" 
Python :: for every file in the folder do python 
Python :: find element by title selenium python 
Python :: how to autosave in python 
Python :: list files in s3 folder python 
Python :: pip.exe The system cannot find the file specified 
Python :: save clipboard data win32clipboard python 
Python :: python run server 
Python :: how to clear console python 
Python :: pandas random sample 
Python :: python find smallest element in dictionary 
Python :: OMP: Error #15: Initializing libomp.a, but found libiomp5.dylib already initialized. 
Python :: how to convert datetime to jdatetime 
Python :: translate sentences in python 
Python :: invert dictionary python 
Python :: how to create a list from csv python 
Python :: use selenium without opening browser 
Python :: python cli parameter 
Python :: how do i print the entire array pthon jupyter 
Python :: python create new pandas dataframe with specific columns 
Python :: distance formula in python 
Python :: python set cwd to file location 
Python :: epoch to datetime python 
Python :: perfect number in python 
Python :: get website content with beautifulsoup 
Python :: jupyter notebook dark theme 
Python :: pytorch tensor add one dimension 
Python :: how to get the current position of mouse on screen using python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =