Opening a File or Take Screenshot on headless mode

Hi Shiwo,

First issue I see is the filename:

/home/shiwo/robot-test/data/temp/5a8ac8e7-70a0-48da-8f71-815abcc50393

From what I remember the browser uses the file extension to determine the mime type when loading a local file, and your file has no extension, so the browser is probably saying I don’t know what to do with this file

First thing I’d try is to use Move File (from OperatingSystem Library) to rename the files as:

/home/shiwo/robot-test/data/temp/5a8ac8e7-70a0-48da-8f71-815abcc50393.pdf

And see if that then works with Go To?

Depending on what you need to validate, there’s a couple of suggestions to consider:

If you just need to verify the file downloaded is a valid PDF file, you could use the pypdf python module, with the builtin Evaluate keyword something like this:

${result}=    Evaluate     pypdf.PdfReader("/home/shiwo/robot-test/data/temp/5a8ac8e7-70a0-48da-8f71-815abcc50393")    modules=pypdf

*Note: I’ve not tried this, so it may take some experimenting

If you need to verify the content of the PDF against a known good PDF, then this library might be useful:

Dave.