-
Notifications
You must be signed in to change notification settings - Fork 763
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
Capture Page Screenshot should not overwrite if file already exist #502
Comments
Should this possibly be configurable with an optional parameter to avoid backwards incompatibility issues? Or should we support something like Regardless is the index configurable, it would be a good idea for the keyword to return an absolute path to the created image. |
There is I agree that returning the path is a good idea and I will make the change. The %d is and interesting proposal. It also opens door to other formatting rules which could be nice to have (but perhaps in next commit and not in this one). With fast thinking, it should not be too hard to do. So should this be default:
In case of %d, should we support something like this
In this scenario, should we also keep the |
I don't think both |
My need is purely to avoid overwrites when I run my test with pabot. I simply want do define the filename with variable l, like ${BROWSER} and I would like avoid adding unique runing number in the end in the robot data. The %d opens nice possibilities and could be more useful. Perhaps I should write a prototype and we can see in which way is the best. |
+1 for prototypes. After thinking this a bit more, I start to like |
I am also starting to think that |
Made the proposal to support #504 proposal does not check does the file exist, but it also meets my needs. Personally I think the #504 is better and provides easier way extend the functionality in the future if needed. The only, although small, possibility for backwards incompatible is that someone might be already use |
I like this much, much better. I completely agree with both of you, the |
I am thinking the same way and let's go with the One thing which comes in my mind, that the code is written now in way that it does not count the number of |
I don't think it would make sense to allow more than one. Check for multiples, raise an exception, and document it. |
True, I will document it and write a test. |
I did updated documentation and re-write the tests in pull request #504. Review would be really nice. |
Did refactor the I am not totally sure, did I get the documentation totally in the way that would be correct, staring from here: https://github.com/robotframework/Selenium2Library/pull/504/files#diff-5346a546c6b37e3c016ad51e7155887dR55 Comments... |
The content of the documentation itself looks good. Formatting can always be tricky, but nothing jumps out at me. You should probably generate out the documentation from your branch and make sure it looks right before merging. |
Closed because #504 was merged. |
I realize this is an old issue, but I think it might need to be revisited. There is a very bad default behavior which I think would be good to fix. If I run a test, get some failures, then run robot again with Here's a concrete example. Save this to /tmp/example.robot:
Run the following commands:
When you do that, the screenshot in the first test will be of bing.com even though the test went to google.com and took a screenshot. While this can be worked around by writing my own "capture page screenshot" keyword, it would be nice if the default behavior played nice with robot's -rerunfailed option out of the box. |
And there are other ways to run into same problem, example with pabot. Reopened because it is valid issue. Would you like to submit PR to fix the problem? |
Yeah, I can probably find time to make a pull request.
My thought was to keep the current behavior when a filename is explicitly
provided to "capture page screenshot" . It is only when a name is computed
do we check for existence. Does that make sense? That way it should just
work out of the box without requiring configuration or additional flags.
…On Fri, May 26, 2017 at 10:47 AM, Tatu Aalto ***@***.***> wrote:
And there are other ways to run into same problem, example with pabot.
Reopened because it is valid issue.
Would you like to submit PR to fix the problem?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/robotframework/Selenium2Library/issues/502#issuecomment-304317655>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABEmYpvdaZXlxiVU2upL5dAHhCnWSW9Lks5r9vQpgaJpZM4F1-gR>
.
|
Does computed mean that the |
What I've got at the moment is that my new code only runs if the filename
contains "{index}"*. If it does, then I compute the filename and then check
if it exists. If it exists then I add one and try again. lather, rinse,
repeat until we compute a filename that doesn't exist. I've tested this
against a folder with 10,000 existing files (meaning, the first time it
runs it calls os.path.exists 10,000 times) and it only takes a couple
milliseconds or so on my linux box. I'm guessing it will be slower on
windows, but probably not egregiously so.
That means that if you have files with the number 1, 2, 5, 6, then run a
new test (which causes the counter to reset to zero), the next screenshot
will have 3, and the one after that will have 7, and then 8, then 9, ...
* perhaps I should check for {index.*} in case someone tries to get fancy
with the formatting.
…On Fri, May 26, 2017 at 2:41 PM, Tatu Aalto ***@***.***> wrote:
Does computed mean that the filename argument is with the default value
or does it mean that filename can be given but contain the running index
number? If it would be possible, I would prefer the later.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/robotframework/Selenium2Library/issues/502#issuecomment-304371753>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABEmYgHiIxStNkpn8Yz5ZGJvgdwf2Bj7ks5r9yrXgaJpZM4F1-gR>
.
|
Sounds good to me, specially with the |
…rwriting files When computing a number to add to a screenshot filename, it will use a number that doesn't cause an existing file to be overwritten.
also removed some tags from tests to be consistent with other tests.
The #501 tries to fix the issue that if the file already exist, then index is added to the file name and file is created with index in file name. Example:
Making issue also, because it helps perform better tracking and if I screw the pull request again, we do not lose the conversation history.
The text was updated successfully, but these errors were encountered: