Class EventsSupport

java.lang.Object
io.fluentlenium.core.events.EventsSupport
All Implemented Interfaces:
EventListener

public class EventsSupport extends Object implements EventListener
EventsSupport can be registered in Selenium EventFiringWebDriver to provide an easier to use events interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventsSupport (EventsRegistry eventsRegistry)
    Creates a new events support
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterAlertAccept (org.openqa.selenium.WebDriver driver)
    Called after Alert.accept()
    void
    afterAlertDismiss (org.openqa.selenium.WebDriver driver)
    Called after Alert.dismiss()
    void
    afterChangeValueOf (FluentWebElement element, org.openqa.selenium.WebDriver driver, CharSequence[] charSequence)
    Called after WebElement.clear(), WebElement.sendKeys(java.lang.CharSequence...), WebElement.sendKeys(CharSequence...) .
    void
    afterClickOn (FluentWebElement element, org.openqa.selenium.WebDriver driver)
    Called after WebElement.click().
    void
    afterFindBy (org.openqa.selenium.By by, FluentWebElement element, org.openqa.selenium.WebDriver driver)
    Called after WebDriver.findElement(...), WebDriver.findElements(...), WebElement.findElement(...), WebElement.findElements(...).
    <X> void
    afterGetScreenshotAs (org.openqa.selenium.OutputType<X> outputType, X x)
    Called after TakesScreenshot.getScreenshotAs(OutputType) ()}
    void
    afterGetText (FluentWebElement webElement, org.openqa.selenium.WebDriver webDriver, String s)
    Called after WebElement.getText() ()}
    void
    afterNavigateBack (org.openqa.selenium.WebDriver driver)
    Called after navigate().back().
    void
    afterNavigateForward (org.openqa.selenium.WebDriver driver)
    Called after navigate().forward().
    void
    afterNavigateRefresh (org.openqa.selenium.WebDriver driver)
    Called after navigate().refresh().
    void
    afterNavigateTo (String url, org.openqa.selenium.WebDriver driver)
    Called after get(String url), navigate().to(String url).
    void
    afterScript (String script, org.openqa.selenium.WebDriver driver)
    Called after JavascriptExecutor.executeScript(String, Object[]) .
    void
    afterSwitchToWindow (String s, org.openqa.selenium.WebDriver webDriver)
    Called after WebDriver.switchTo() ()}
    void
    beforeAlertAccept (org.openqa.selenium.WebDriver driver)
    Called before Alert.accept()
    void
    beforeAlertDismiss (org.openqa.selenium.WebDriver driver)
    Called before Alert.dismiss()
    void
    beforeChangeValueOf (FluentWebElement element, org.openqa.selenium.WebDriver driver, CharSequence[] charSequence)
    Called before WebElement.clear(), WebElement.sendKeys(java.lang.CharSequence...), WebElement.sendKeys(CharSequence...).
    void
    beforeClickOn (FluentWebElement element, org.openqa.selenium.WebDriver driver)
    Called before WebElement.click().
    void
    beforeFindBy (org.openqa.selenium.By by, FluentWebElement element, org.openqa.selenium.WebDriver driver)
    Called before WebDriver.findElement(...), WebDriver.findElements(...), WebElement.findElement(...), #findElement WebElement.findElements(...).
    <X> void
    beforeGetScreenshotAs (org.openqa.selenium.OutputType<X> outputType)
    Called before TakesScreenshot.getScreenshotAs(OutputType) ()}
    void
    beforeGetText (FluentWebElement webElement, org.openqa.selenium.WebDriver webDriver)
    Called before WebElement.getText() ()}
    void
    beforeNavigateBack (org.openqa.selenium.WebDriver driver)
    Called before navigate().back().
    void
    beforeNavigateForward (org.openqa.selenium.WebDriver driver)
    Called before navigate().forward().
    void
    beforeNavigateRefresh (org.openqa.selenium.WebDriver driver)
    Called before navigate().refresh().
    void
    beforeNavigateTo (String url, org.openqa.selenium.WebDriver driver)
    Called before get(String url), navigate().to(String url).
    void
    beforeScript (String script, org.openqa.selenium.WebDriver driver)
    Called before JavascriptExecutor.executeScript(String, Object[])
    void
    beforeSwitchToWindow (String s, org.openqa.selenium.WebDriver webDriver)
    Called before WebDriver.switchTo() ()}
    void
    onException (Throwable throwable, org.openqa.selenium.WebDriver driver)
    Called whenever an exception would be thrown.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EventsSupport

      public EventsSupport (EventsRegistry eventsRegistry)
      Creates a new events support
      Parameters:
      eventsRegistry - events registry
  • Method Details

    • beforeNavigateTo

      public void beforeNavigateTo (String url, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before get(String url), navigate().to(String url).
      Specified by:
      beforeNavigateTo in interface EventListener
      Parameters:
      url - URL
      driver - WebDriver
    • afterNavigateTo

      public void afterNavigateTo (String url, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after get(String url), navigate().to(String url). Not called, if an exception is thrown.
      Specified by:
      afterNavigateTo in interface EventListener
      Parameters:
      url - URL
      driver - WebDriver
    • beforeNavigateBack

      public void beforeNavigateBack (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before navigate().back().
      Specified by:
      beforeNavigateBack in interface EventListener
      Parameters:
      driver - WebDriver
    • afterNavigateBack

      public void afterNavigateBack (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after navigate().back(). Not called, if an exception is thrown.
      Specified by:
      afterNavigateBack in interface EventListener
      Parameters:
      driver - WebDriver
    • beforeNavigateForward

      public void beforeNavigateForward (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before navigate().forward().
      Specified by:
      beforeNavigateForward in interface EventListener
      Parameters:
      driver - WebDriver
    • afterNavigateForward

      public void afterNavigateForward (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after navigate().forward(). Not called, if an exception is thrown.
      Specified by:
      afterNavigateForward in interface EventListener
      Parameters:
      driver - WebDriver
    • beforeNavigateRefresh

      public void beforeNavigateRefresh (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before navigate().refresh().
      Specified by:
      beforeNavigateRefresh in interface EventListener
      Parameters:
      driver - WebDriver
    • afterNavigateRefresh

      public void afterNavigateRefresh (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after navigate().refresh(). Not called, if an exception is thrown.
      Specified by:
      afterNavigateRefresh in interface EventListener
      Parameters:
      driver - WebDriver
    • beforeFindBy

      public void beforeFindBy (org.openqa.selenium.By by, FluentWebElement element, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before WebDriver.findElement(...), WebDriver.findElements(...), WebElement.findElement(...), #findElement WebElement.findElements(...).
      Specified by:
      beforeFindBy in interface EventListener
      Parameters:
      by - locator being used
      element - will be null, if a find method of WebDriver is called.
      driver - WebDriver
    • afterFindBy

      public void afterFindBy (org.openqa.selenium.By by, FluentWebElement element, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after WebDriver.findElement(...), WebDriver.findElements(...), WebElement.findElement(...), WebElement.findElements(...).
      Specified by:
      afterFindBy in interface EventListener
      Parameters:
      by - locator being used
      element - will be null, if a find method of WebDriver is called.
      driver - WebDriver
    • beforeClickOn

      public void beforeClickOn (FluentWebElement element, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before WebElement.click().
      Specified by:
      beforeClickOn in interface EventListener
      Parameters:
      element - the WebElement being used for the action
      driver - WebDriver
    • afterClickOn

      public void afterClickOn (FluentWebElement element, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after WebElement.click(). Not called, if an exception is thrown.
      Specified by:
      afterClickOn in interface EventListener
      Parameters:
      element - the WebElement being used for the action
      driver - WebDriver
    • beforeChangeValueOf

      public void beforeChangeValueOf (FluentWebElement element, org.openqa.selenium.WebDriver driver, CharSequence[] charSequence)
      Description copied from interface: EventListener
      Called before WebElement.clear(), WebElement.sendKeys(java.lang.CharSequence...), WebElement.sendKeys(CharSequence...).
      Specified by:
      beforeChangeValueOf in interface EventListener
      Parameters:
      element - the WebElement being used for the action
      driver - WebDriver
      charSequence - value of the element
    • afterChangeValueOf

      public void afterChangeValueOf (FluentWebElement element, org.openqa.selenium.WebDriver driver, CharSequence[] charSequence)
      Description copied from interface: EventListener
      Called after WebElement.clear(), WebElement.sendKeys(java.lang.CharSequence...), WebElement.sendKeys(CharSequence...) . Not called, if an exception is thrown.
      Specified by:
      afterChangeValueOf in interface EventListener
      Parameters:
      element - the WebElement being used for the action
      driver - WebDriver
      charSequence - value of the element
    • beforeGetText

      public void beforeGetText (FluentWebElement webElement, org.openqa.selenium.WebDriver webDriver)
      Description copied from interface: EventListener
      Called before WebElement.getText() ()}
      Specified by:
      beforeGetText in interface EventListener
      Parameters:
      webElement - WebElement
      webDriver - WebDriver
    • afterGetText

      public void afterGetText (FluentWebElement webElement, org.openqa.selenium.WebDriver webDriver, String s)
      Description copied from interface: EventListener
      Called after WebElement.getText() ()}
      Specified by:
      afterGetText in interface EventListener
      Parameters:
      webElement - WebElement
      webDriver - WebDriver
      s - String
    • beforeScript

      public void beforeScript (String script, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before JavascriptExecutor.executeScript(String, Object[])
      Specified by:
      beforeScript in interface EventListener
      Parameters:
      script - the script to be executed
      driver - WebDriver
    • afterScript

      public void afterScript (String script, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after JavascriptExecutor.executeScript(String, Object[]) . Not called if an exception is thrown
      Specified by:
      afterScript in interface EventListener
      Parameters:
      script - the script that was executed
      driver - WebDriver
    • onException

      public void onException (Throwable throwable, org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called whenever an exception would be thrown.
      Specified by:
      onException in interface EventListener
      Parameters:
      throwable - the exception that will be thrown
      driver - WebDriver
    • beforeAlertAccept

      public void beforeAlertAccept (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before Alert.accept()
      Specified by:
      beforeAlertAccept in interface EventListener
      Parameters:
      driver - WebDriver
    • afterAlertAccept

      public void afterAlertAccept (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after Alert.accept()
      Specified by:
      afterAlertAccept in interface EventListener
      Parameters:
      driver - WebDriver
    • beforeAlertDismiss

      public void beforeAlertDismiss (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called before Alert.dismiss()
      Specified by:
      beforeAlertDismiss in interface EventListener
      Parameters:
      driver - WebDriver
    • afterAlertDismiss

      public void afterAlertDismiss (org.openqa.selenium.WebDriver driver)
      Description copied from interface: EventListener
      Called after Alert.dismiss()
      Specified by:
      afterAlertDismiss in interface EventListener
      Parameters:
      driver - WebDriver
    • beforeSwitchToWindow

      public void beforeSwitchToWindow (String s, org.openqa.selenium.WebDriver webDriver)
      Description copied from interface: EventListener
      Called before WebDriver.switchTo() ()}
      Specified by:
      beforeSwitchToWindow in interface EventListener
      Parameters:
      s - String
      webDriver - WebDriver
    • afterSwitchToWindow

      public void afterSwitchToWindow (String s, org.openqa.selenium.WebDriver webDriver)
      Description copied from interface: EventListener
      Called after WebDriver.switchTo() ()}
      Specified by:
      afterSwitchToWindow in interface EventListener
      Parameters:
      s - String
      webDriver - WebDriver
    • beforeGetScreenshotAs

      public <X> void beforeGetScreenshotAs (org.openqa.selenium.OutputType<X> outputType)
      Description copied from interface: EventListener
      Called before TakesScreenshot.getScreenshotAs(OutputType) ()}
      Specified by:
      beforeGetScreenshotAs in interface EventListener
      Type Parameters:
      X - object
      Parameters:
      outputType - OutputType
    • afterGetScreenshotAs

      public <X> void afterGetScreenshotAs (org.openqa.selenium.OutputType<X> outputType, X x)
      Description copied from interface: EventListener
      Called after TakesScreenshot.getScreenshotAs(OutputType) ()}
      Specified by:
      afterGetScreenshotAs in interface EventListener
      Type Parameters:
      X - object
      Parameters:
      outputType - OutputType
      x - object