Skip to content

Avoid taking selector screenshots twice - #216

Open
Muguett-DBY wants to merge 1 commit into
simonw:mainfrom
Muguett-DBY:fix/avoid-duplicate-selector-screenshots
Open

Muguett-DBY wants to merge 1 commit into
simonw:mainfrom
Muguett-DBY:fix/avoid-duplicate-selector-screenshots

Conversation

@Muguett-DBY

@Muguett-DBY Muguett-DBY commented Nov 14, 2026 •

Copy link
Copy Markdown

When a selector screenshot is written to a file, take_shot() calls locator.screenshot(path=...) twice, overwriting the first capture. The first call already writes the file, so this removes the second call.

The new test covers both file and byte output. Against the base, the file case fails because the locator is called twice; on this branch, it passes. I ran those two cases and nine existing URL/filename cases with pytest: 11 passed. Those 11 pytest cases used a mocked Playwright page. Separately, I ran a selector screenshot smoke test on Windows with Playwright 1.64.1 and Chromium 156: file output took two screenshots on the base and one on this branch, and file and byte output both produced 80×40 PNGs. The full tests/test_image_formats.py file also passed on this commit with the same real browser setup: 32 passed, including WebP stdout and multi-image format coverage. I haven't run the entire test suite locally.

Developed and tested with Codex assistance.


📚 Documentation preview 📚: https://shot-scraper--216.org.readthedocs.build/en/216/

GitHub's upstream Test workflow currently reports action_required and has not started any jobs.

This branch has not been deployed

No deployments
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.

1 participant