i can click the calendar manually but selenium can’t

Mistake in code mm = driver.find_element_by_xpath('//*[@id="{}"]'.format(month)). You find first element in DOM(which combined with element data instead data2) and it is not visible yet.

There is workig code

mm = driver.find_element_by_id('date2').find_element_by_class_name('months-view').find_element_by_id(month)

Also good deal, to use WebDriverWait, because the site is very slow.

for example

to_date = WebDriverWait(driver, 10).until(
        (By.XPATH, '//*[@id="date2"]/angular2-date-picker/div/div[1]/i'))) 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top