I am trying to scrape data from a website https://www.eex.com/en/market-data/power/futures#%7B%22snippetpicker%22%3A%2228%22%7D. With a little help I got as far as the code below, but I would need data for different dates (you can choose a specific date in the dropdown widget on the left). I got stuck here.
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
import time
import pandas as pd
driver = webdriver.Chrome()
driver.get(url='https://www.eex.com/en/market-data/power/futures')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[value='I accept all cookies.']"))).click()
time.sleep(3)
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.btn.dropdown-toggle.form.input-select div.filter-option-inner"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='dropdown-menu show']//li/a[@class='dropdown-item']/span[contains(., 'EEX German Power Futures')]"))).click()
table_data = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div#baseloadwidget_pfpde > table.mv-quote"))).get_attribute("outerHTML")
df_list = pd.read_html(table_data)
if len(df_list) > 0:
df = df_list[0]
print(df)
else:
print("No data found on the table.")
driver.quit()
I am trying to scrape different data published on different dates but I can't seem to get through.