A little trick to auto click buttons in Linkedin using Javascript and HTML

Jelly Tran
2 min readApr 21, 2020

--

I usually play with the Chrome console dev tool when it comes to clicking buttons multiple times. This trick is fun for lazy people like me

For example, I have 50 contacts waiting to connect with me. In order to click all of these 50 buttons at the same time, I did the following steps:

50 contacts want to get in touch
  1. Open Chrome dev tool by Cmd+shift+I , inspect the class of these 50 buttons. Usually, the button would have the same class name pattern. If you can get the class name pattern, you could select all of them
to inspect by chrome dev tool to get the button class name common pattern

2. Use this piece of code to select elements with the extracted class name and assign a variable to store them. In this case, I assign for the buttonList constant

const buttonList = document.getElementsByClassname(“button-class-name”)
select by getElementsByClassname

3. After that, we would have an HTML node collection. So the next step is to loop this list and click every single item. However, you can’t use the forEach function for Javascript array because buttonList is a Node list, not an array. All you have to do is to convert it to an array using the below code:

Array.from(buttonList).forEach((button)=>{  button.click()})
loop and click all of 50 buttons

Finally, I record the whole process in the below GIF. Enjoy your internet browsing experience ^^

--

--

Jelly Tran
Jelly Tran

Written by Jelly Tran

jelly, web developer, currently in Singapore

No responses yet