Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
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.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda