I try to scrap the table in frame(URL:https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html)
my code:
driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
sleep(1)
driver.find_element_by_link_text('Current').click()
sleep(2)
xpath = "//*[@id='MainContent_pnlContainer']/div[3]/div/div/div/div[3]/div/table/tbody/tr[1]"
table = driver.find_element_by_xpath(xpath)
tabletext = table.text
my code can't find frame.
and I try below code without select frame.
tabletext = driver.page_source
tabletext = BeautifulSoup(tabletext , 'html.parser')
but it can't parse content in frame.
please let me know how I can scrap below table. enter image description here
Try to access the iframe using following XPath:
driver.find_element(By.XPATH,".//*[starts-with(@id,'cmeIframe-')]")