10. Automating Dynamic Tables & Infinite Scroll

Extracting Table Data

rows = driver.find_elements(By.CSS_SELECTOR, "table tbody tr")
for row in rows:
    columns = row.find_elements(By.TAG_NAME, "td")
    if columns and "Active" in columns[2].text:
        print("Found active user:", columns[0].text)

# Infinite scroll using execute_script:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

Task

  • Implement parse_row_data:
  • 1. Accept cells list of strings.
  • 2. Return {"id": cells[0], "name": cells[1]}.
💡Common doubts
Did you like the problem?
Lesson 10 of 16
Python
Loading code editor…
Next