The goal of my test is to assert that a popup does not appear after certain actions. Previously to test if the popup exist, I have used exception handling.
try:
self.driver.find_element_by_id("fancybox-close").click()
except Exception ('ElementNotVisibleException'):
print "No popup"
This works fine for the test: to assert if the popup exists.
But as soon as I change the goal to: assert if the popup does not exist, the exception handling solution becomes very expensive (exception handling takes a lot of time in Python) and a test that would execute in 3 seconds now takes up to a minute.
Is there a way around this? Is there a quicker way to check if an element does not exist using the webdriver Python binding?