I'm using selenium to grab all support page of some site.On one particular page i have one error . Here the code of the page :
<a href="?a=support" class="">
<span><b></b> Contact</span>
<b></b> Contact
</a>
I'm trying with many try / except condition to find a support page.
try:
print ("FINDING SUPPORT ...")
driver_hyip.find_element_by_css_selector("a[href*='support']").click()
driver_hyip.execute_script("window.alert = function() {};")
except:
try:
print ("NOT FINDING SUPPORT, TRYING ANOTHER WAY")
driver_hyip.find_element_by_xpath("//a[@href='?a=support']").click()
except:
print ("NOT FINDING SUPPORT, TRYING TO FIND CONTACT")
driver_hyip.find_element_by_css_selector("a[href*='contact']").click()
I expected my code find the page, but I got :
Message: no such element: Unable to locate element: {"method":"css selector","selector":"a[href*='contact']"}
PS : Do you know if there is some other way to try multiple path in selenium ? Because here i'm doing lot of try / except in my code.