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

223
Views
Get new elements once you click a buttom

I want to automate a process that requiere to download a file.

I have to do a search, specifing a string in a search box and then clicking buttom (called: "ctl00$MainContent$BtnBusqueda"). Once the results are showed, you can download an unique results to a file with a buttom (called: "BtnDescarga").

I already could input the string to the search box and perform the search with this (iterable to automate over a string array):

function setUUID(element, index, array) {
    document.getElementsByName("ctl00$MainContent$TxtUUID")[0].value=element;
    document.getElementsByName("ctl00$MainContent$BtnBusqueda")[0].click();
}

So, I can call that over a string array with: array.forEach(setUUID)

I tried to finish the problem downloading the file with this:

function setUUID(element, index, array) {
    document.getElementsByName("ctl00$MainContent$TxtUUID")[0].value=element;
    document.getElementsByName("ctl00$MainContent$BtnBusqueda")[0].click();
    document.getElementsByName("BtnDescarga")[0].click();
}

But I get:

Uncaught TypeError: Cannot read properties of undefined (reading 'click')
    at setUUID (<anonymous>:4:49)
    at Array.forEach (<anonymous>)
    at <anonymous>:1:7

I'm new in JavaScript but I barely understand that the element called "BtnDescarga" only appears when the search it's done, so, it "appends" to the document. Then, how before the search it doesnt exist, it can't be foundt.

So, any solution to this? Anyway to access to a new element in document that only appears when you click a buttom? or any better solution to this?

Thanks overall.

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!