Retry on stale element exceptions
Retry on stale element exceptions

An element is stale if it no longer exists. It no longer exists if:
* We're on a different page
* An ajax request removed the element (and replaced it with a new
  identical element)

This commit wraps the elements returned by selenium queries with new
AntiStaleElements. These elements, on calling getattr, catch
StaleElementExceptions and retry 5 times. The retry re-executes the
initial locator and overwrites the underlying element.

alphagov/notifications-functional-tests,alphagov/notifications-functional-tests