I am trying to extract tables from a website for multiple dates. I am using the following code to do so.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROMEDRIVER_PATH = 'C:/Users/asus/Downloads/chromedriver/chromedriver.exe'
options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(CHROMEDRIVER_PATH, chrome_options=options)
URL = 'URL'
driver.get(URL)
driver.find_element_by_id('calender1').click()
driver.find_element_by_css_selector(css_slctr).click() #css_selector for date
driver.find_element_by_id('show').click()
driver.page_source().text
# # print(html)
But the above code is giving a TypeError as follows.
TypeError Traceback (most recent call last)
<ipython-input-35-a6ffd4caf5cf> in <module>
9
10 # driver.page_source().text
---> 11 driver.page_source().text
12 # # print(html)
TypeError: 'str' object is not callable
I tried the same element selectors in Rselenium and I was able to extract the desired table. Since I'm new to Python I'm not sure what this error means! According to what I read here and here it seems to me that, this error occurs when we try to redefine a built-in function(Please correct me, if i misunderstood). But I believe, I did not redefine any built-in function here. So why am I getting this error? And how can I solve this?