def wait_for_element_to_disappear(self, locator, params=None, timeout=None):
        """
        Waits until the element is not visible (hidden) or no longer attached to the DOM.

        Raises TimeoutException if element does not become invisible.

        :param locator: locator tuple or WebElement instance
        :param params: (optional) locator params
        :param timeout: (optional) time to wait for element (default: self._explicit_wait)
        :return: None
        """
        exp_cond = eec.invisibility_of if isinstance(locator, WebElement) else ec.invisibility_of_element_located
        try:
            self._get(locator, exp_cond, params, timeout, error_msg="Element never disappeared")
        except (StaleElementReferenceException, NoSuchElementException):
            return True