title: How to automate clicks on elements
body: <p>I got a lot of saved posts/comments on reddit(seems to be like a thousand), and wondered how I would go about unsaving them, without clicking unsave on everyone of them. </p>
  
  <p>This is my approach so far:</p>
  
  <p>I right-clicked on the <code>Unsave</code> button of a post and clicked Inspect to find out the class-name,
  which I then used to analyse how many posts have that button:</p>
  
  <pre><code>document.getElementsByClassName("_10K5i7NW6qcm-UoCtpB3aK _3tRpmsTw--cwH6_MAO3ZOm _3yh2bniLq7bYr4BaiXowdO _2sAFaB0tx4Hd5KxVkdUcAx _28vEaVlLWeas1CDiLuTCap")
  </code></pre>
  
  <p>That results in an array, and I would now go further and save this in a variable to run a function with an click-event on it:</p>
  
  <pre><code>var buttonInstances = document.getElementsByClassName("_10K5i7NW6qcm-UoCtpB3aK _3tRpmsTw--cwH6_MAO3ZOm _3yh2bniLq7bYr4BaiXowdO _2sAFaB0tx4Hd5KxVkdUcAx _28vEaVlLWeas1CDiLuTCap")
  
  buttonInstances.someClickFunction()
  </code></pre>
  
  <p>Thing is, (besides me not knowing exactly what <code>someClickFunction()</code> should do), the save button seems to have the same class. How would you go about this? I've seen some solutions, but the code seems deprecated, and I am just keep copying and pasting and getting errors.</p>
  
  <p>Maybe someone could point me in the right direction, and maybe on the way I could collect some further knowledge about <code>let</code> and <code>var</code>,  and why I should use arrow functions etc... </p>
  
  <p>I hope this should convince you that I have at least tried something by myself.</p>