Skip to content

fix: screenshot type inferred from path file extension #2951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2025

Conversation

xianghuzhao
Copy link
Contributor

@xianghuzhao xianghuzhao commented Aug 15, 2025

The screenshot methods for both element and page do not really infer file type from path file extension if type is not provided. I tried some name like 'xxx.jpeg' without type in arguments, the generated file format was actually png.
This pull request is trying to fix this.

Fixes #2955

@xianghuzhao
Copy link
Contributor Author

@microsoft-github-policy-service agree

@mxschmitt
Copy link
Member

Please start with filing an issue, changes like this would require us to make it across all the language ports we maintain.

@xianghuzhao
Copy link
Contributor Author

Please start with filing an issue, changes like this would require us to make it across all the language ports we maintain.

OK. An issue is created in #2955

Copy link
Member

@mxschmitt mxschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Any chance for a test? Ideally in tests/async/test_screenshot.py.

@xianghuzhao
Copy link
Contributor Author

Looks great! Any chance for a test? Ideally in tests/async/test_screenshot.py.

Tests were added. Please have a check.

@mxschmitt mxschmitt merged commit 254aabd into microsoft:main Aug 19, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Screenshot type is not inferred from path file extension
2 participants