selenium.webdriver.common.bidi.network¶
Classes
|
|
|
Represents a network event. |
|
Represents an intercepted network request. |
- class selenium.webdriver.common.bidi.network.NetworkEvent(event_class: str, **kwargs: Any)[source]¶
Represents a network event.
- classmethod from_json(json: dict[str, Any]) NetworkEvent[source]¶
- class selenium.webdriver.common.bidi.network.Network(conn: WebSocketConnection)[source]¶
- EVENTS = {'auth_required': 'network.authRequired', 'before_request': 'network.beforeRequestSent', 'continue_auth': 'network.continueWithAuth', 'continue_request': 'network.continueRequest', 'fetch_error': 'network.fetchError', 'response_completed': 'network.responseCompleted', 'response_started': 'network.responseStarted'}¶
- PHASES = {'auth_required': 'authRequired', 'before_request': 'beforeRequestSent', 'response_started': 'responseStarted'}¶
- add_request_handler(event: str, callback: Callable[[Request], Any], url_patterns: list[Any] | None = None, contexts: list[str] | None = None) int[source]¶
Add a request handler to the network.
- Args:
event: The event to subscribe to. callback: The callback function to execute on request interception.
Takes Request object as argument.
url_patterns: A list of URL patterns to intercept. Default is None. contexts: A list of contexts to intercept. Default is None.
- Returns:
int: callback id
- remove_request_handler(event: str, callback_id: int) None[source]¶
Remove a request handler from the network.
- Args:
event: The event to unsubscribe from. callback_id: The callback id to remove.
- class selenium.webdriver.common.bidi.network.Request(network: Network, request_id: Any, body_size: int | None = None, cookies: Any | None = None, resource_type: str | None = None, headers: Any | None = None, headers_size: int | None = None, method: str | None = None, timings: Any | None = None, url: str | None = None)[source]¶
Represents an intercepted network request.