Closed
Description
The Selenium project has an interesting solution,
EventFiringWebDriver:
- http://www.seleniummonster.com/eventfiringwebdriver-and-event-listeners-in-selenium/
- http://www.abodeqa.com/2014/06/08/event-listeners-in-selenium-webdriver/
- and lots of staff that Google can find
Everything is cool but I think there are disadvantages for Appium users:
- this implementation restricts the using of mobile-specific functions till
AppiumDriver d = (AppiumDriver) eventFiringWebDriver.getWrappedDriver();
The same is true for elements
MobileElement e = (MobileElement) ((WrapsElement) element).getWrappedDriver();
- almost all interfaces which are nested in WebDriver has protected/private implementations here. So an end user has to duplicate the present code when there is need to extend it
What is supposed to be designed:
- it is supposed that the WebDriverEventListener interface will be reused. Also it would be cool if there were interfaces whose implementations allow to listen to (optionally) events of alerts, windows, contexts and so on.
- To design a solution which has linear architecture. It would be cool to use Spring & AspectJ here.
http://www.mkyong.com/spring3/spring-aop-aspectj-annotation-example/