Repository navigation
osn-selenium v1.0.0-beta.5
Pre-releaseosn-selenium v1.0.0-beta.5 - Comprehensive DevTools Protocol Integration & Fingerprint Detection
This major release transforms the library into a powerful tool for low-level browser control and analysis. We have introduced a fully-featured DevTools Manager, typed wrappers for Chrome DevTools Protocol (CDP) commands, and a sophisticated Fingerprint Detection system. This update bridges the gap between high-level Selenium interactions and raw protocol manipulation, supporting both synchronous and asynchronous (Trio) execution contexts.
Key Improvements in v1.0.0-beta.5:
-
Advanced DevTools Manager:
A robustDevToolsmanager has been implemented to handle the lifecycle of the BiDi (Bidirectional) connection. It automatically manages browser targets (pages, iframes, workers), handling auto-attachment to new targets based on configurable filters. This ensures you never lose control of a pop-up or a new tab. -
Fingerprint Detection System:
We have introduced a dedicatedFingerprintMixinand JavaScript injection system.- Script Injection: Automatically injects a specialized script (
start_fingerprint_detection.js) that hooks into sensitive browser APIs (Canvas, AudioContext, WebGL, Navigator, Screen, etc.). - Real-time Logging: Detects and logs when scripts attempt to derive a unique browser fingerprint.
- Optimized Reporting: Includes settings to optimize event traffic, preventing log flooding while capturing unique API access attempts.
- Script Injection: Automatically injects a specialized script (
-
Comprehensive CDP Executors:
Gone are the days of sending raw JSON commands. We have added fully typed executors for a vast array of CDP domains, includingNetwork,Page,DOM,Emulation,Security,Profiler, and more.- Sync & Async Support: Executors are available for both synchronous workflows and
trio-based asynchronous workflows. - Ease of Use: Methods like
page.capture_screenshot,network.emulate_network_conditions, oremulation.set_device_metrics_overrideare now directly accessible with type hinting.
- Sync & Async Support: Executors are available for both synchronous workflows and
-
Network Interception & Manipulation (Fetch Domain):
Deep integration with theFetchdomain allows for granular network control.- Request Pausing: capability to pause requests and decide whether to continue, fail, or fulfill them.
- Auth Handling: Built-in handlers for
AuthRequiredevents (e.g., Basic Auth). - Response Mocking: Ability to fulfill requests with custom bodies, headers, and status codes directly from Python.
-
Granular Logging Architecture:
The logging system has been completely overhauled to support the new complexity.- Categorized Logs: Separation of general CDP logs and specific Fingerprint Detection logs.
- Per-Target Logging: Logs are organized by target ID, making it easy to debug specific tabs or frames.
- Main Summary Log: An aggregated log file summarizes activity across all channels, tracking statistics on API usage and event frequency.
-
Strict Typing with Pydantic:
The internal data structures now rely heavily onPydanticmodels (DictModel,TargetData,DevToolsSettings). This ensures strict validation of configuration settings and CDP event data, reducing runtime errors caused by malformed data.
Putting It All Together:
With v1.0.0-beta.5, osn-selenium evolves from a standard automation tool into a forensic analysis and advanced control suite. Whether you need to mock network responses for testing, debug complex race conditions using the raw CDP protocol, or audit a website for privacy-invasive fingerprinting techniques, this release provides the typed, stable, and asynchronous foundations to do so effectively.