This is the source I want to scrape data from https://www.fxstreet.com/economic-calendar/world-interest-rates
When you click on each bank's name, a chart would pops up and there are table rows and data values.
However, this charts are hidden. Because the attribute overflow:hidden.
How do I extract all the values that are in the chart?
I have already wrote a code that manages to iterate through and click each bank's name to display the chart.
But I have no idea how to extract the values from the charts. Please help. Thanks.
This is my code:
driver = webdriver.Chrome('chromedriver.exe')
driver.get('https://www.fxstreet.com/economic-calendar/world-interest-rates')
time.sleep(10)
soup = BeautifulSoup(driver.page_source,"lxml")
time.sleep(10)
read_mores = driver.find_elements_by_xpath('//a[@href="#"]')
for read in read_mores:
driver.execute_script("arguments[0].scrollIntoView();", read)
driver.execute_script("(arguments[0]).click();", read)
time.sleep(1)
list_of_rows = []
table = soup.select("table")[0]
for row in table.findAll('tr'):
list_of_cells = []
for cell in row.findAll(["th","td"]):
list_of_cells.append(cell.text)
list_of_rows.append(list_of_cells)
for item in list_of_rows:
print(''.join(item))
time.sleep(1)
driver.quit()