I am writing automation test in Selenium using Python. One element may or may not be present. I am trying to handle it with below code, it works when element is present. But scr
the way you are doing it is fine.. you are just trying to catch the wrong exception. It is named NoSuchElementException not nosuchelementexception
NoSuchElementException
nosuchelementexception