📜  selenium if 语句 python 代码示例

📅  最后修改于: 2022-03-11 14:45:16.240000             🧑  作者: Mango

代码示例1
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("...")