from selenium.common.exceptions import NoSuchElementException** try: driver.find_element_by_css_selector('.holiday_notice_close a').click() except NoSuchElementException as e: print(e)