if not(browser.find_element_by_xpath('//div[@id="MainCopy_ctl13_presentJob_EmailAddressPanel"]//a')):
email = 'No data'
else:
email = browser.find_element_by_xpath('//div[@id="MainCopy_ctl13_presentJob_EmailAddressPanel"]//a').get_attribute("textContent")
print(email)
browser.find_element_by_xpath('//div[@id="MainCopy_ctl13_presentJob_EmailAddressPanel"]//a')).get_attribute("textContent")
don't have data.i wrote a condition if we dont have data in the provided xpath it should replace with 'no data'.
if data present we need to store email address else we need to store default value (i.e) 'no data'
this is the error i am receiving every time.
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@id="MainCopy_ctl13_presentJob_EmailAddressPanel"]//a"} (Session info: chrome=88.0.4324.150)