'Selenium WebDriver waitForElementPresent when Javascript refreshes

I have a Selenium script (Python) using WebDriver that does

WebDriverWait(driver, long_wait).until(
    EC.presence_of_element_located(find_element(driver, selector))
)

However the page the script is "waiting" for the element to appear on is using Javascript to refresh itself. The page refreshes itself every second and a "success" element will appear after a few refreshes. It appears upon refresh the above command exits however I want it to wait indefinitely (or for a long period) even across client/browser refreshing.

Is this possible with WebDriver?

Edit: Here's the body of the method. Ignore my debugging hacks :)

def waitForElementPresent(self, driver, selector):
    try:
        WebDriverWait(driver, 10, ignored_exceptions=[
            NoSuchElementException, StaleElementReferenceException
        ]).until(EC.presence_of_element_located(find_element(driver,     selector)))
    except NoSuchElementException:
        print("No such element, waititng again")
        self.waitForElementPresent(driver, selector)

    print("Returning normally")
    return

The finally is reached on the first javascript refresh on the client.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source