I am writing automation test in Selenium using Python. One element may or may not be present. I am trying to handle it with below code, it works when element is present. But scr
from selenium.common.exceptions import NoSuchElementException
try:
elem = driver.find_element_by_xpath(".//*[@id='SORM_TB_ACTION0']")
elem.click()
except NoSuchElementException: #spelling error making this code not work as expected
pass