Selenium if оператор Python

try:
    elem = driver.find_element_by_partial_link_text('Create Activity')
    if elem.is_displayed():
        elem.click() # this will click the element if it is there
        print("FOUND THE LINK CREATE ACTIVITY! and Clicked it!")
except NoSuchElementException:
    print("...")
Wandering Warbler