So I have a print form to a pdf button, and want to save that pdf for further comparisons in the same testcase.
Is there a way to use Browser keywords, such as “Promise to wait for download” to download pdf to current directory?
I have tried many ways without succeeding, the problem being that “save file as” is not part of the browser context. I can get to the stage where pressing print would get me to “save file as” part when manually doing the steps.
Also as the pdf is generated at that instance, there is no direct url to file
Been there too, where I needed to check pdf content, and also get a screenshot of the content.
From my understanding and search in ways to interact with the PDF viewer, main issue is that buttons (i.e. the print/download one) are in shadow-dom and not easily interactable.
On my side I finally choose to do this :
Start browser (Chrome here) with options to directly download the file
Check content with PyPDF2 and a .py file
Eventually , as the PDF is directly downloaded and not displayed , open it to perform the required screenshot. Note here that it’s OK while your content his in first page
Challenging thing then is if you need to scroll down the pdf for visual checks.
How do you directly download the pdf?
That has been my issue, cant seem to be able to get that file for comparison.
In my case there is no one file to download, so I could use that Download -keyword properly.