I am trying to determine the best way to test for an action that results in an element disappearing. The use case is testing that clicking a close button causes a menu to close. There are different approaches I have found online but I am having trouble determining which one is best.
I can use a try/catch and catch the NoSuchElementException thrown when trying to find the element that has now disappeared. I can also use WebDriverWait with ExpectedConditions.InvisibilityOfElementLocated. BUT it seems like there should be a way to properly assert that something doesn’t exist?