'Is there a way to compare the date I chose from calendar to displayed date?
driver.find_element(By.XPATH, '//input[@placeholder="MM/DD/YYYY"]').click()
print(WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((
By.CSS_SELECTOR, '.react-datepicker__day--today'))).text)
driver.find_element(By.CSS_SELECTOR, '.react-datepicker__day--today').click()
this is part of my code, I am using it to select a date from calendar, the chosen date is "Today" this date is dynamic. Need to compare that the today date is actual todays. Is there a way to do the comparison? Thanks
Solution 1:[1]
Save web elements text as string, then convert it to date object, and compare to real date. For example: https://www.educative.io/edpresso/how-to-convert-a-string-to-a-date-in-python
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | IvanMikhalka |
