1. import java.lang.reflect.Method;
  2. import net.sf.cglib.proxy.MethodProxy;
  3. import org.openqa.selenium.StaleElementReferenceException;
  4. import org.primitive.logging.Log;
  5. import org.primitive.testobjects.testobject.TestObjectExceptionHandler;
  6. public class StaleElementReferenceExceptionHandler extends TestObjectExceptionHandler {
  7. public StaleElementReferenceExceptionHandler() {
  8. super(StaleElementReferenceException.class);
  9. }
  10. //this handles StaleElementReferenceException that appears while work with the main page content
  11. //is performed.
  12. public Object handleException(Object obj, Method original, MethodProxy methodProxy, Object[] args,
  13. Throwable t) throws Throwable {
  14. Log.debug("StaleElementReferenceException has been caught!", t);
  15. Log.debug("Another attempt to execute " + methodProxy.getSuperName());
  16. return methodProxy.invokeSuper(obj, args);
  17. }
  18. }
Comments powered by Disqus