Skip to content

osn-selenium v1.0.0-beta.5

Pre-release
Pre-release

Choose a tag to compare

@oddshellnick oddshellnick released this 15 Jan 21:12
· 5 commits to dev since this release

osn-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:

  1. Advanced DevTools Manager:
    A robust DevTools manager 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.

  2. Fingerprint Detection System:
    We have introduced a dedicated FingerprintMixin and 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.
  3. 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, including Network, 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, or emulation.set_device_metrics_override are now directly accessible with type hinting.
  4. Network Interception & Manipulation (Fetch Domain):
    Deep integration with the Fetch domain 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 AuthRequired events (e.g., Basic Auth).
    • Response Mocking: Ability to fulfill requests with custom bodies, headers, and status codes directly from Python.
  5. 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.
  6. Strict Typing with Pydantic:
    The internal data structures now rely heavily on Pydantic models (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.