您需要先导入异常
from selenium.common.exceptions import NoSuchElementException
然后您可以引用它
except NoSuchElementException: # handle the element not existing

您需要先导入异常
from selenium.common.exceptions import NoSuchElementException
然后您可以引用它
except NoSuchElementException: # handle the element not existing