How to download a file with browser suggested filename


While I would need that all downloads are saved with browser suggested filename rather than custom name or random guid, I noticed this is not possible with current Wait For Download implementation. What I mean is, when I download manually a file from the application I get the same file name and extension all the time, while when downloading with Browser library, there is a guid name with no extension for the downloaded file.

This need is similar with this issue:

Maybe this will be implemented at some point in Browser library, however in the meantime I assume I could use a custom jsextension for this, but unfortunately this is not so easy without JS knowledge.

Could you suggest how to implement such keyword extension for download with the suggested filename?

It turns out that it is easy to extend the Browser library with a new keyword, e.g. for adding some missing functionality already available in Playwright. This is very cool.

In case anyone is interested, here is the sample code I am proposing, for creating a custom keyword in Javascript named “Wait For Download With Filename” that will return also the suggested browser filename, and then use it to rename the downloaded file.


That is nice.

But a pull request to the Browser project is also nice. Or first an issue. :wink:

We are always open to good ideas!

1 Like