To click on a link programmatically in the javascript you can just use an element.click()

To get the element use document.getElementByID('id').

Please refer to the following code pen for an example of how to programmatically perform the click operation on any element.

<html>
  <head> </head>
  <body>
   
    <a href="https://google.com" id="link"> 
        This is an achor element and being pointed to google.com 
    </a>
    <script> document.getElementById('link').click(); </script>
 
    </body>
</html>