Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!