2

How to directly download and save a file by button click using Splash Lua?

Example page and the download button: screenshot of the website

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.

Bill Huang
  • 4,491
  • 2
  • 13
  • 31
  • I have checked with lua and after clicking the button and waiting some while I get `Failed Loading Page`, so making this click will redirect the page to a download without a `Save As` prompt. – Stackbeans Feb 17 '22 at 17:11

0 Answers0