I'm trying to access the chart data (high chart format) from the below website using Python & Selenium. The default "1 year" option works perfect, but when I use Selenium to click "5Y" option in chart & get data, it still returns the "1Y" information.
import time
from selenium import webdriver
website = 'https://www.moneycontrol.com/nps/nav/lic-pension-fund-scheme-g-tier-ii/SM003010'
# Open Website
driver = webdriver.Firefox()
driver.get(website)
time.sleep(2)
# Click on 5 Year Option in Chart
driver.find_element_by_id("li_5y").click()
time.sleep(2)
# Get Data from Highcharts Series
output = driver.execute_script('return window.Highcharts.charts[2].series[0].options.data')
driver.close()
I've also tried an alternative for clicking 5 year data but the same issue persists:
driver.execute_script("get_stock_graph('','5Y','li_5y','fiveymfd_5')")
Any advice would be appreciated on how to get the refreshed driver page info.
Thanks!