Oct-06-2019, 05:07 AM
(Oct-05-2019, 07:27 PM)Martinelli Wrote: So, does anyone know how can I check if that object exists before try to use it?You can wrap your code into try/except clause, e.g.
from selenium.common.exceptions import NoSuchElementException # ... try: nav.find_element_by_xpath('/html/body/div[1]/div/div[3]/div[1]/div/div[2]/div/div/span[1]/p[1]') except NoSuchElementException: pass # or do something