https://app.powerbigov.us/view?r=eyJrIjoiZDQxYTM0MDMtMGQ2Mi00ZTRkLThmNzQtNTYyYjBhNjhiMTQyIiwidCI6IjUwNzZjM2QxLTM4MDItNGI5Zi1iMzZhLWUwYTQxYmQ2NDJhNyJ9
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url = "https://app.powerbigov.us/view?r=eyJrIjoiZDQxYTM0MDMtMGQ2Mi00ZTRkLThmNzQtNTYyYjBhNjhiMTQyIiwidCI6IjUwNzZjM2QxLTM4MDItNGI5Zi1iMzZhLWUwYTQxYmQ2NDJhNyJ9"
driver = webdriver.Chrome()
driver.get(url)
table = WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.XPATH, "//div[@role='grid']")))
driver.execute_script("arguments[0].scrollTop = arguments[0].scrollHeight;", table)
#WebDriverWait(driver, 15).until(lambda d: len(d.find_elements("xpath","//div[@role='row']")) > 21)
#tried the above code to wait for new rows to load
rows = driver.find_elements("xpath","//div[@role='row']")
for row in rows:
try:
cells = row.find_elements("xpath",".//div[@role='gridcell' and not(@class='prefix-cell')]")
for cell in cells:
print(cell.text, end=" ")
except Exception as e:
print("Error:", e)
driver.quit()
#
I am using this code. There are 105 rows each in the 2 tables in the dashboard.
this code can only return 20 rows from both the tables.
Please suggest how to proceed. It will be really helpful if someone can suggest full code. I feel that the table is not getting scrolled and the whole page is getting scrolled.
ankit bhaskar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.