I have this code below:
def test_counter(self):
try:
if self.driver.find_element_by_id(self.counter).text == 'texttexttext':
return True
except NoSuchElementException and StaleElementReferenceException:
self.fix_error()
return False
And I cannot figure out why the NoSuchElementException
or the StaleElementReferenceException
are not being caught.