- import java.lang.reflect.Method;
- import net.sf.cglib.proxy.MethodProxy;
- import org.openqa.selenium.StaleElementReferenceException;
- import org.primitive.logging.Log;
- import org.primitive.testobjects.testobject.TestObjectExceptionHandler;
- public class StaleElementReferenceExceptionHandler extends TestObjectExceptionHandler {
- public StaleElementReferenceExceptionHandler() {
- super(StaleElementReferenceException.class);
- }
- //this handles StaleElementReferenceException that appears while work with the main page content
- //is performed.
- public Object handleException(Object obj, Method original, MethodProxy methodProxy, Object[] args,
- Throwable t) throws Throwable {
- Log.debug("StaleElementReferenceException has been caught!", t);
- Log.debug("Another attempt to execute " + methodProxy.getSuperName());
- return methodProxy.invokeSuper(obj, args);
- }
- }