'How to simulate a mouse click on an anchor tag

I'm writing a chrome extension and from that extension i want to click on a particular anchor tag in a webpage on a particular website.

let helpRequestButton = document.querySelectorAll(".live-doubt-item-resolve.ng-scope a");

Using this query selector i'm able to get the anchor tag from the web page which looks like.

<a data-ga-label="resolve_now_live" data-ga-action="clicked" ng-if="helpRequestObj.item_type === 'Topic'" ng-click="claimLiveRequest($event, true, helpRequestObj.id)" target="_blank" class="content-heading ng-scope" data-ga-category="HelpRequestDashboardLive"> </a>

I just want to click on this tag using java script. But helpRequestButton.click() dosent work. I have tried the same solution with jQuery(did'nt work). Also i tried to search a lot on web on how to simulate a mouse click and none of the solutions worked uptill now.

Just for refrence i'm giving the code snippet of my extension what chrome would call one the webpage is loaded. The button which i have to click is present on the web page.

let timeOut;

function stopTimeout() {
    clearTimeout(timeOut);
}

function checkIncomingHelpRequests() {
    let helpRequestButton = document.querySelectorAll(".live-doubt-item-resolve.ng-scope a");
    console.log(helpRequestButton[0]);
    if (helpRequestButton.length > 0) {
       

> ***// This is the place i want to click the button.***

        // helpRequestButton.
        //helpRequestButton.click();
    }
}

function selectTag() {
    // var object = document.querySelector(".main-class");
    // console.log(object);
    let liButton = document.querySelectorAll(".pointer.tab.ga-event-tracker")[0];
    //let liButton = $("li.pointer.tab.ga-event-tracker")[0];
    //console.log(liButton);
    if (liButton !== undefined) {
        liButton.click();
        checkIncomingHelpRequests();
    }
    timeOut = setTimeout("selectTag()", timeOutInterval);
}

$(document).ready(function () {
    selectTag();
});

Please help me. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source