I'm trying to get the data from a html table that seems to load data on a table based on the value of dropdown (with a default value). However, when I do the selenium click() on the dropdown, the table values change but the data I get is still from the old page. How do I get the updated values instead? Here, is the code I've tried.
Note: The URL I'm trying for example is this one
from selenium import webdriver
browser = webdriver.Firefox()
browser.get(url) # you can use the url linked above for example
if browser.find_element_by_xpath(
'//a[@id = "user-header-oddsformat-expander"]/span').text != 'IN Odds':
# choose a type of odd that you want from the top dropdown menu
browser.find_element_by_xpath(
'//a[@id = "user-header-oddsformat-expander"]').click()
browser.find_element_by_xpath(
'//ul[@id = "user-header-oddsformat"]/li/a/span[contains(text(), "IN Odds")]').click()
browser.implicitly_wait(10)
table = browser.find_elements_by_css_selector('div#odds-data-table')
for elem in table:
print elem.text
Here, even after performing the click() before dong find_elements...(), I still get the data from the originally loaded table, not the new one. How do I do that?