elem = driver.find_elements_by_xpath('AAA')
if not len(elem):
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "BBB"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "CCC"))).click()
else:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "CCC"))).click()
find element doesn't return true or false , use find_elements intead and check the length . if length is not zero then element exists. so not len(elem)
checks it doesn't exist meaning false
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…