Click here to Skip to main content
15,509,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I want a website to check if a certain xpath is available and if so, the script should continue to be executed and if not it should continue to search until he found the xpath.

Thanks for answers ;).

What I have tried:

from selenium.common.exceptions import NoSuchElementException

def check_exists_by_xpath(xpath):


except NoSuchElementException:

return False

return True

i tried this but it dont worked for me maybe i used it wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900