'How to click() in a readonly input field using python selenium in the time of automation?

Want to click in the date got from console with the if condition
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

# Date of Journey
journeyDate = browser.find_element_by_xpath("//div[@class='col-md-6']//div[@class='form-group']//input[@id='doj']")
journeyDate = browser.execute_script("arguments[0].removeAttribute('readonly')",
                                             WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH,
                                                                                                          "//div[@class='col-md-6']//div[@class='form-group']//input[@id='doj']"))))
journeyDateAvlbe = browser.find_elements(By.XPATH, "//table[@class='ui-datepicker-calendar']//td[@data-event='click']//a[@class]")
# journeyDateAvlbeMonth = browser.find_elements(By.XPATH, "//table[@class= 'ui-datepicker-calendar']//tr//td[@data-event='click' ]//a").getattribute("data-month")
# journeyDateAvlbeYear = browser.find_elements(By.XPATH, "//table[@class= 'ui-datepicker-calendar']//tr//td[@data-event='click' ]//a").getattribute("data-year")
# print(journeyDateAvlbe.get_attribute("data-month"))
# print(journeyDateAvlbeYear)
for journeyDateAvlbeTxt in journeyDateAvlbe:
    print(journeyDateAvlbeTxt.text)
journeyDateAvlbeInputCMD = input("Enter a date of journey")
browser.implicitly_wait(30)
for journeyDateAvlbeTxt in journeyDateAvlbe:
    journeyDateAvlbeInput = journeyDateAvlbeTxt.text
    # error point
    if  journeyDateAvlbeInput == journeyDateAvlbeInputCMD:
        browser.implicitly_wait(30)
        journeyDateAvlbeTxt.click()
    else:
        print("date not found !")
    break

time.sleep(10)
browser.implicitly_wait(30)
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source