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

100
Visualizações
click button by javascript after popup appears

So, on the website, there's a button after which you click, there appears a new popup that also has a button. What I am trying to achieve is that by javascript, I wanna click the first button and when pop-up appears, i want to click on that another button.

Code:

var arr = document.getElementsByClassName("firstButtonClassName");

for (var i = 1, len = arr.length; i < len; i++) {
   arr[i].click();
   console.log(document.getElementsByClassName("popupButtonClassName"))
}

with the above code, first button is clicked fine and popup appears, but as you can see, console log above prints empty array instead of the array that contains popup's button..

Is there some trick I don't understand ?

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