Skip to content Skip to sidebar Skip to footer

Selenium Python Pass Date Parameter Using Calendar

I am trying to pull data from following page: https://www.lifeinscouncil.org/industry%20information/ListOfFundNAVs I have to select the name of the company and select a date from

Solution 1:

The date is in "a" tag. You can try to do select the date using "link-text".

    driver.find_element_by_id("MainContent_imgbtncalender").click()#CalenderIcon
    driver.find_element_by_link_text("27").click()#Date

As per your comment I tried to traverse through dates but it only worked for that particular month. I tried to use "send_keys()" to that text box and its not working. Below is the code to traverse it for a month.

driver.get("https://www.lifeinscouncil.org/industry%20information/ListOfFundNAVs")
driver.find_element_by_id("MainContent_drpselectinscompany").click()
driver.find_element_by_xpath("//option[starts-with(text(),'Aditya')]").click()
driver.find_element_by_id("MainContent_imgbtncalender").click()
driver.find_element_by_link_text("1").click()
driver.find_element_by_id("MainContent_btngetdetails").click()
dateval = 2whileTrue:
    if dateval == 32:
        breaktry:
        driver.find_element_by_id("MainContent_imgbtncalender").click()
        driver.find_element_by_link_text(str(dateval)).click()
        driver.find_element_by_id("MainContent_btngetdetails").click()
        dateval+=1
        time.sleep(2)
    except:
        driver.switch_to.default_content()
        dateval+=1
        time.sleep(2)

time.sleep(5)
driver.quit()

Post a Comment for "Selenium Python Pass Date Parameter Using Calendar"