- Add ClickCoordinateEvent to handle coordinate-based clicking via CDP
- Replace broken page.mouse.click() with CDP Input.dispatchMouseEvent
- Add safety checks for file inputs, select elements, and print dialogs
- Add get_dom_element_at_coordinates() to BrowserSession for element detection
- Add force parameter to ClickElementAction to optionally skip safety checks
- Update _click_by_coordinate to dispatch ClickCoordinateEvent instead of using mouse
This fixes coordinate clicking functionality by using CDP directly instead of
the broken Actor mouse object, matching the implementation from mert/everything_coordinates.
Updated the logging level for session management methods in BrowserSession to debug for more granular logging. This change applies to the reset, kill, and stop methods, enhancing the clarity of log outputs during browser session operations without cluttering the info logs.
- Added defensive checks in SessionManager to skip target attachment and focus recovery if the browser is shutting down (i.e., _cdp_client_root is None).
- Introduced a connection lock in BrowserSession to prevent concurrent connection attempts, ensuring safe CDP client management.
- Improved logging for session reset and connection handling, providing clearer insights into the browser session state during operations.
- Enhanced error handling when stopping the CDP client and clearing session manager state on initialization failures.
These changes improve the robustness and reliability of session management in the browser environment.
- Adjusted the structure of event handling for 'networkIdle' and 'load' events to improve readability and maintainability.
- Ensured that logging for page readiness is consistently executed within the event handling logic.
- Improved the `create_task_with_error_handling` function to allow for better exception logging and retrieval based on the `suppress_exceptions` parameter.
- Updated `SessionManager` to implement event-driven recovery for stale agent focus, replacing polling with efficient event handling.
- Refactored session retrieval methods to ensure focus validation and recovery are handled automatically.
- Enhanced logging for recovery processes and session management to provide clearer insights into state changes and errors.
- Adjusted various watchdogs to utilize the new session management methods, ensuring they correctly handle focus validation and session retrieval.
- Updated cdp-use dependency to version 1.4.4 for improved functionality.
- Increased max WebSocket frame size to 200MB in BrowserSession to accommodate large DOMs.
- Eliminated the caching of target types in SessionManager, simplifying the management of target information.
- Updated various components to directly access target types from the Target objects, enhancing clarity and reducing redundancy.
- Adjusted related methods in BrowserSession, CrashWatchdog, and DomService to reflect the changes in target type retrieval.
- Simplified comments in session.py for clarity and conciseness.
- Removed the unused `disconnect` method from the CDPSession class.
- Updated references to session management in downloads_watchdog.py for consistency.
- Introduced a utility function `create_task_with_error_handling` to manage asyncio tasks with proper exception logging and suppression options.
- Updated multiple components, including `SessionManager`, `BrowserSession`, and various watchdogs, to utilize the new error handling mechanism for background tasks.
- Enhanced overall robustness of asynchronous operations by ensuring exceptions are logged and handled appropriately, improving maintainability and debugging capabilities.
- Consolidated tab switching logic to improve clarity and reduce redundancy in the `on_NavigateToUrlEvent` method.
- Enhanced logging for tab switching and navigation events to provide better insights during debugging.
- Ensured proper lifecycle handling during navigation, including closing extension options pages and dispatching navigation events consistently.
- Changed `get_session_for_target` in `SessionManager` from async to sync, improving performance by removing unnecessary locking.
- Updated all references in `BrowserSession` and related watchdogs to use the new synchronous method for session retrieval.
- Enhanced readability and consistency across session management logic, ensuring a more streamlined approach to handling sessions.
- Replaced instances of `agent_focus` with `agent_focus_target_id` across various components to ensure consistent target management.
- Enhanced error handling and logging in `Watchdog` classes to reflect the new target ID approach.
- Improved session retrieval methods to streamline interactions with the `SessionManager`, ensuring better performance and reliability.
- Updated focus change event dispatch in `SessionManager` to use a fallback URL ('about:blank') when the target is not found, preventing potential errors.
- Modified `BrowserSession` to exclude the `session_manager` from serialization, ensuring cleaner data handling.
- Introduced a new `Target` class to represent browser targets, separating target properties from session management.
- Updated `SessionManager` to maintain a single source of truth for all targets and sessions, improving data integrity.
- Refactored session retrieval methods to ensure consistent access to sessions and targets, enhancing performance and readability.
- Improved logging for session and target operations, providing clearer insights into state changes and actions.
- Introduced `get_all_page_sessions` method in `SessionManager` to fetch all active page/tab sessions.
- Updated `BrowserSession` to utilize the new method for improved navigation and tab management, enhancing performance and readability.
- Refactored related navigation event handling to leverage cached session data instead of direct CDP calls.