I'm trying to learn how to get data from a website that loads data through some javascript into a table. For example, the website is here
I used Selenium to get the data from the tables here. Here's the code
browser = webdriver.PhantomJS()
wait = WebDriverWait(browser, 10)
browser.get(url) # using the page linked above
wait.until(EC.presence_of_element_located(
(By.ID, 'fancybox-outer')))
print("Page loaded")
browser.find_element_by_xpath(
'//div[contains(@class, "tabs")]/ul/li[text() = "All"]').click()
data_table = browser.find_element_by_xpath('//div[@class="grid-canvas"]')
for rows in data_table.find_elements_by_xpath(
'//div[contains(@class, "slick-row")]'):
row = rows.text.split('\n')
print(row)
However, it only get the partial data since the data is loaded in the table dynamically as the table is scrolled. How do I get the data from the "All" table while taking care of the scrolling?
There is also a "Export To CSV" Data button at the bottom that I could use to get the data I need, but a click() event on that button isn't giving me the csv data in the code. If possible, getting this csv would be better.