我已经检查了所有以前的类似问题,它们不适用于我的情况。
try: element = wait.until( EC.presence_of_element_located((By.XPATH, "//*[@id='_ariaId_73.folder'] | //*[@id='_ariaId_133.folder']")) ) except: print "403 : Monitoring Not Found" element.click()
它是不会进入异常块还可以,但它仍然抛出ElementNotVisibleException的element.click()方法。
ElementNotVisibleException
element.click()
关于解决方案的几句话:
presence_of_element_located()
visibility_of_element_located()
click()
element_to_be_clickable()
try: element = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[@id='_ariaId_73.folder'] | //*[@id='_ariaId_133.folder']"))) except: print "403 : Monitoring Not Found" element.click()