Laurent Veys
Laurent Veys

Reputation: 133

How can I trigger the click of an HTML button on a webpage?

I need to automate something.

I need to go a lot to a page, and click some buttons to download excel files (Communicatie > Exporteer ...). I would like to just enter a link that directly executes the buttons. I don't know if this is possible.

Screenshot 1

When inspecting the source code, there is no link visible or something. I already tried https://mysite.be/page#communicatie_export_users_xlsx But this doesn't work. What am I doing wrong?

Screenshot 2

Thanks in advance! Laurent

Upvotes: 1

Views: 1777

Answers (1)

mplungjan
mplungjan

Reputation: 178421

Try using this bookmarklet:

javascript:(function() { document.querySelector("#communicatie_export_users_xlsx").click()})() 

create a bookmark and paste the above into it. Then you can just click the bookmark on the page.

An alternative is to first press F12, go to network and then click the button to see what the link is they actually call. That link can be automated if they allow it. You may run into violating their TOS

Upvotes: 2

Related Questions