Skip to content

fix: screenshot Errors if path without file extension is provided with specifying type#2966

Closed
kmcgon wants to merge 2 commits intomicrosoft:mainfrom
kmcgon:fix_screenshot_error_path_no_ext
Closed

fix: screenshot Errors if path without file extension is provided with specifying type#2966
kmcgon wants to merge 2 commits intomicrosoft:mainfrom
kmcgon:fix_screenshot_error_path_no_ext

Conversation

@kmcgon
Copy link

@kmcgon kmcgon commented Sep 4, 2025

Fixes #2965

If a path without a file type extension is provided without passing the file type arg to screenshot, it will throw an Error that you provided an invalid mimetype (None).

This causes the --screenshot command line arg in the playwright-pytest plugin to no longer work, as it passes a path without an extension.

Documentation on playwright.dev and the docstrings state the default screenshot file type should be PNG, this PR will default to PNG if type or a file extension in path are not provided.

@kmcgon
Copy link
Author

kmcgon commented Sep 4, 2025

@microsoft-github-policy-service agree

@mxschmitt
Copy link
Contributor

Should be fixed by microsoft/playwright-pytest#290 and available in the pytest plugin as v0.7.1.

@mxschmitt mxschmitt closed this Sep 9, 2025
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 Errors if path without file extension is provided with specifying type

2 participants

Comments