Skip to content
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

[Feature] ability to get screenshot/video/trace files directly within script #1217

Closed
ksdaftari opened this issue Mar 21, 2022 · 1 comment
Closed

Comments

@ksdaftari
Copy link

ksdaftari commented Mar 21, 2022

I brought up similar comment in microsoft/playwright-pytest#77 but thought this comment likely was best served here.

it would be nice to be able while in script to be able to get the screenshot/video/trace file directly within script.

my specific use case, is that as part of using pytest, use allure-pytest. with this when was using selenium could easily attach screenshots via code that looked like below and wondering if similar functionality could be possible with the screenshot/video/trace functionality within playwright

allure.attach(driver.get_screenshot_as_png(), name=description, attachment_type=allure.attachment_type.PNG)

if there is already way to do this or better suggestion given current functionality within playwright, if could give reference let me know,

my initial guess is perhaps expected to use like https://playwright.dev/python/docs/api/class-video#video-save-as and using pytest-tempdir could save video, there and read into an allure attach (i have not tried this yet but if end up doing and works may end up closing issue, unless others think suggestion would be useful)

@ksdaftari
Copy link
Author

im closing my issue for now i think seeing now that https://playwright.dev/python/docs/api/class-page#page-screenshot does return file buffer (code i had above should be able to be re-used), and given code in microsoft/playwright-pytest#77 that should work fine for video (given really just want for that scenario and interim in test.

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

No branches or pull requests

1 participant