How to directly download and save a file by button click using Splash Lua?
Example page and the download button:
Conditions:
- The download URL is generated dynamically upon button click
- Clicking the button will open a "Save As" prompt window to save the Excel file
- I am using a Splash docker service on
localhost:8050
. I write Lua script directly on the page.
I have searched the official docs about binary download, but the closest things I have managed to find were html:jpeg
, html:png
and response.body
, which didn't quite seem to hit the mark. I also found no explicit examples or tutorials on Youtube.
Note: Please do not give workarounds such as using Selenium. I am only interested in how to do it with Lua.