This commit updates the DownloadsWatchdog class to specify exception types in the error handling logic, replacing broad exception catches with more precise ones (AssertionError, KeyError, AttributeError). Additionally, it adds a warning log when no downloads path is configured, ensuring better error visibility and handling during download operations.
This commit updates the DownloadsWatchdog class to ensure that the downloads directory path is properly expanded and resolved to an absolute path. The changes include:
- Expanding the downloads path using `expanduser()` and `resolve()` methods to handle user home directories correctly.
- Updating the download behavior settings to use the expanded path.
- Ensuring that the downloads directory is created with the resolved path.
Additionally, the example feature for downloading files has been modified to use a temporary downloads path for testing purposes.
- Introduced `record_video_framerate` and `record_video_size` parameters to the BrowserSession class for enhanced video recording capabilities.
- Updated example in video_recording.py to reflect changes, switching from BrowserSession to Browser for video recording setup.
This update allows users to customize video recording settings more effectively.
- Improved clarity and organization of viewport behavior for both headless and headful modes.
- Ensured user preferences for viewport settings are respected and not overridden.
- Added assertions to validate configuration states, enhancing robustness.
This update aims to streamline the user experience when configuring browser profiles.
- Added logic to respect user-provided viewport settings when initializing the browser profile.
- Ensured that if a viewport is explicitly set by the user, it will not be overridden by default behaviors in headful mode.
- Improved clarity in the viewport configuration process for both headless and headful modes.
This change aims to provide a more intuitive experience for users configuring their browser profiles.
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Ensure custom user agent is applied by adding the --user-agent flag to
browser launch args. Fixes the ignored user_agent setting so pages load
with the expected UA.
<!-- End of auto-generated description by cubic. -->
Removed MAX_SCREENSHOT_HEIGHT and MAX_SCREENSHOT_WIDTH constants that were not being used anywhere in the codebase.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Updated the type hint for the _FONT_CACHE dictionary to use a union type for better clarity. Modified the return type of get_cross_platform_font function to reflect the same change, enhancing type safety and readability.
This will make "https://www.example.com" match "https://*.example.com", which
is currently no longer the case.
Also, update the exact match logic to match the logic in pattern matching.