-
Notifications
You must be signed in to change notification settings - Fork 120
Save screenshot to tempfile in text mode #133
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
Comments
I was able to save the screenshots to disk, using Selenium's save_screenshot(file_path). Hope it helps. |
@ramonasuciu yeah you can take them manually without issues, but it's less convenient than pytest-selenium doing so on only failures, which as far as I can see it already does but it drops the screenshot if not using HTML reports. |
@xmo-odoo what I meant is that pytest-html still picks the screenshots which are now created as png files, not as base64, and attaches them to the corresponding failing scenario in the html report. Please let me know if you'd need more details on how I've done this. Thanks, |
@BeyondEvil that's pretty much my original suggestion: if not generating an HTML report (or possibly even then), save failure screenshots to a temporary file and print the file path. |
@xmo-odoo Yes :) The problem I can see with dumping the file being the default, is littering the filesystem with screenshots. |
It would be fairly simple for you to do this yourself in a |
That's a good solution, but perhaps using the |
@nicoddemus But doesn't the tmpdir "system" do some form of cleanup right before pytest is finished? I was trying to find out, but got lost in the code... |
Yes it does, but only after 3 attempts it seems |
Agreed, I'd use |
@davehunt But.. but.. wouldn't pytest delete the file then when it's done? Or did I misinterpret @nicoddemus ? |
I understood that pytest preserves the temporary directories for the last three runs.
… On 10 Sep 2018, at 18:41, Jim Brännlund ***@***.***> wrote:
@davehunt But.. but.. wouldn't pytest delete the file then when it's done?
Or did I misinterpret @nicoddemus ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
How can I access the |
I'm not entirely sure that you can, but perhaps @nicoddemus has a suggestion..? |
Screenshots are really valuable tools for debugging selenium test (even more so when running in headless Firefox or Chrome). Currently, pytest-selenium injects screenshots into HTML reports, but maybe it could also save those screenshots to the disk and give the file path in the text summary, possibly optionally? At the moment it generates a (base64) screenshot in every case and just drops it when
html
is not enabled.The text was updated successfully, but these errors were encountered: