try: elem = driver.find_element_by_xpath(".//*[@id='SORM_TB_ACTION0']") elem.click() except nosuchelementexception: pass