selenium.webdriver.support.event_firing_webdriver

Classes

EventFiringWebDriver(driver, event_listener)

A wrapper around an arbitrary WebDriver instance which supports firing events.

EventFiringWebElement(webelement, ef_driver)

A wrapper around WebElement instance which supports firing events.

class selenium.webdriver.support.event_firing_webdriver.EventFiringWebDriver(driver: WebDriver, event_listener: AbstractEventListener)[source]

A wrapper around an arbitrary WebDriver instance which supports firing events.

Creates a new instance of the EventFiringWebDriver.

Args:
  • driver : A WebDriver instance

  • event_listener : Instance of a class that subclasses AbstractEventListener and implements it fully or partially

Example:

from selenium.webdriver import Firefox
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener

class MyListener(AbstractEventListener):
    def before_navigate_to(self, url, driver):
        print("Before navigate to %s" % url)
    def after_navigate_to(self, url, driver):
        print("After navigate to %s" % url)

driver = Firefox()
ef_driver = EventFiringWebDriver(driver, MyListener())
ef_driver.get("http://www.google.co.in/")
property wrapped_driver: WebDriver

Returns the WebDriver instance wrapped by this EventsFiringWebDriver.

get(url: str) None[source]
back() None[source]
forward() None[source]
execute_script(script, *args)[source]
execute_async_script(script, *args)[source]
close() None[source]
quit() None[source]
find_element(by='id', value=None) WebElement[source]
find_elements(by='id', value=None) List[WebElement][source]
class selenium.webdriver.support.event_firing_webdriver.EventFiringWebElement(webelement: WebElement, ef_driver: EventFiringWebDriver)[source]

A wrapper around WebElement instance which supports firing events.

Creates a new instance of the EventFiringWebElement.

property wrapped_element: WebElement

Returns the WebElement wrapped by this EventFiringWebElement instance.

click() None[source]
clear() None[source]
send_keys(*value) None[source]
find_element(by='id', value=None) WebElement[source]
find_elements(by='id', value=None) List[WebElement][source]