I have a list of all of the people (I in this case) follow, I am trying to go through everyone's page and see if they have a link in their BIO if they do I want their account to be added to a new list. otherwise, I want to do nothing with said user.
Using xpath I have identified that users who do not have a link have this xpath /html/body/div[1]/section/main/div/header/section/div[2]/a
and users that do have a link have this xpath /html/body/div[1]/section/main/div/header/section/div[2]/a[1]
If I run driver.find_element_by_xpath("/html/body/div[1]/section/main/div/header/section/div[2]/a[1]")
and the user does not have a link I should get an error as we are unable to locate the xpath.
How would I go about checking which of the two xpaths is present?