MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / fire_session_event

Method fire_session_event

py/selenium/webdriver/remote/webdriver.py:1854–1883  ·  view source on GitHub ↗

Fire a custom session event to the remote server event bus. This allows test code to trigger server-side utilities that subscribe to the event bus. Args: event_type: The type of event (e.g., "test:failed", "log:collect", "marker:add"). payload: Optio

(self, event_type: str, payload: dict | None = None)

Source from the content-addressed store, hash-verified

1852 self.execute(Command.DELETE_DOWNLOADABLE_FILES)
1853
1854 def fire_session_event(self, event_type: str, payload: dict | None = None) -> dict:
1855 """Fire a custom session event to the remote server event bus.
1856
1857 This allows test code to trigger server-side utilities that subscribe to
1858 the event bus.
1859
1860 Args:
1861 event_type: The type of event (e.g., "test:failed", "log:collect", "marker:add").
1862 payload: Optional data to include with the event.
1863
1864 Returns:
1865 A dictionary containing the response data including success status,
1866 event type, and timestamp.
1867
1868 Raises:
1869 WebDriverException: If the event cannot be fired.
1870
1871 Examples:
1872 Simple event::
1873
1874 driver.fire_session_event("test:started")
1875
1876 Event with payload::
1877
1878 driver.fire_session_event("test:failed", {"testName": "LoginTest", "error": "Element not found"})
1879 """
1880 params: dict[str, str | dict] = {"eventType": event_type}
1881 if payload:
1882 params["payload"] = payload
1883 return self.execute(Command.FIRE_SESSION_EVENT, params)["value"]
1884
1885 @property
1886 def fedcm(self) -> FedCM:

Calls 1

executeMethod · 0.95