python selenium webscraping “NoSuchElementException” not recognized

You need to import the exception first

from selenium.common.exceptions import NoSuchElementException

and then you can reference it

except NoSuchElementException:
    # handle the element not existing

If you would like to give details of the exception in your output then you can use:

except NoSuchElementException as exc:
    print(exc) # and/or other actions to recover 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)