Repository navigation
Fix #1882: screenshot infinite loop with escaped index braces - #2005
Open
b-vamsipunnam wants to merge 2 commits into
Open
b-vamsipunnam wants to merge 2 commits into
b-vamsipunnam wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a hang in
Capture Page ScreenshotandCapture Element Screenshotwhen the filename contains an escaped marker such as{{index}}and the output file already exists.Motivation
Using
brackets-{{index}}-name.pngcreates a file namedbrackets-{index}-name.png. Taking another screenshot with the same filename hangs because the code keeps increasing the index, but the escaped marker always produces the same filename.Implementation
I updated the formatter to check whether the filename actually uses
index. Escaped markers now allow the existing file to be overwritten, while real index fields still produce unique filenames. This also covers nested formatting such as{other:>{index}}.Tests
I updated the existing escaped-braces test to take the screenshot twice. It timed out before the fix and passed afterward.
I also added acceptance tests for repeated element screenshots and filenames containing both escaped braces and a formatted index. A new unit test checks that nested index formatting selects an available filename when the first file already exists.
git diff --check upstream/masterpassed.Files Changed
src/SeleniumLibrary/keywords/screenshot.pysrc/SeleniumLibrary/utils/path_formatter.pyatest/acceptance/keywords/screenshots.robotutest/test/keywords/test_screen_shot.pyRelated Issues
Fixes #1882.
Request
If appropriate, could you add the
acknowledgelabel to #1882? Thank you!