How to make this nested loop with exceptions print out success, if it catches the NoSuchElementException?
for key, value in a.items():
for key, value in b.items():
if “abc” not in value:
driver.get(url)
try:
if pyautogui.locateCenterOnScreen(death, grayscale=True, confidence=.3) is not None:
driver.close()
elif pyautogui.locateCenterOnScreen(death2, grayscale=True, confidence=.3) is not None:
driver.close()
elif driver.find_element_by_xpath(element1).is_displayed():
driver.close()
else:
if pyautogui.locateCenterOnScreen(element2, grayscale=True, confidence=.5) is not None:
break
elif driver.find_element_by_xpath(element3).is_displayed():
break
else:
driver.close()
except NoSuchElementException as nse:
**GOTO print(‘SUCCESS!’)**
except Exception as eeee:
driver.close()
else:
print('this should never appear!')
print(‘SUCCESS!’)