Atozed Forums

Full Version: Using TIdHTTP to click a button on web page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I need to be able to programmatically click a Download CSV button here and save the file locally.

https://www.nasdaq.com/market-activity/stocks/screener

I used TIdHTTP previously for downloading files but not when the button click in involved.
I have to admit i am not much into HTTP GET/POST stuff.

Any help would be greatly appreciated.

Thank you.
(03-20-2022, 09:20 AM)admctfdotcom Wrote: [ -> ]I need to be able to programmatically click a Download CSV button here and save the file locally.

https://www.nasdaq.com/market-activity/stocks/screener

I used TIdHTTP previously for downloading files but not when the button click in involved.

Unfortunately, that page makes heavy use of CSS. The button in question does not appear to be inside of a traditional HTML webform. So, there is likely some backend scripting involved to handle the click. And when I do click on the button and try to watch the subsequent HTTP requests in the browser's debugger, I don't see an HTTP request that actually results in the CSV file being downloaded. I do see an initial HTTP request that responds with a compressed JSON, but after that, I don't know what the browser is doing to finish the download. Also, that initial request is using HTTP/2, which Indy does not support at this time. So, I couldn't tell you if/how it is possible to implement this particular download with Indy without more details.