Open simonmeggle opened 4 months ago
@allcontributors please add @simonmeggle for ideas.
@aaltat
@simonmeggle already contributed before to ideas
Seems that Playwright has limitations when page can saved as pdf. It works only Chromium headless, but I think it is still good idea to have it. Also supporting emulateMedia in one way or another is good option. Currently I am thinking that it could be separate keyword, but should it be done by default when pdf is created?
Also I am thinking that path
is always a mandatory parameter and therefore we will save pdf file always to the disk. Something like:
${pdf} = Save Page As Pdf page.pdf # Would be saved to ${OUTPUT_DIR}/page.pdf ${pdf} contains the path to file
${pdf} = Save Page As Pdf ${OUTPUT_DIR}/page.pdf # Same asa above
Also there is support for many interesting formatting options in pdf which keyword should also support.
Currently I am leaning that towards that emulateMedia would be separate keyword.
See https://playwright.dev/docs/api/class-page#page-pdf
Supporting the
pdf()
function of playwright would make it possible to test the browser's "print to pdf" functionality. Even when screenshots in full length are alreay possible, PDFs represent a different use case.Perhaps switching the media type to "print" would also make sense to get an even more realistic result, see https://stackoverflow.com/questions/72324669/playwright-download-via-print-to-pdf
Happy to hear your thoughts, thanks! :-)