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

145
Views
Cómo hacer clic en un tramo sin nombre o ID

Estoy tratando de usar Pupeteer para responder a un cuadro de diálogo emergente, pero no puedo encontrar la manera de hacer clic en el botón Aceptar, que es solo una imagen dentro de un <span>

Esto es lo que he probado hasta ahora:

 const [button] = await frame.$x('/html/body/div/div[4]/div[2]/div/span[1]'); if (button) { await button.click() }

Pero no se encuentra el botón.

Esta es la sección pertinente del html:

 <div class="vtm_text vtm_exportDialog"><input type="hidden" value="save"> ... <span class="vtmBtn" style="min-width: 60px; padding: 3px;">OK</span> <span class="vtmBtn" style="min-width: 60px; padding: 3px;">Cancel</span> </div>

Así es como se ve la página cuando se inspecciona en Chrome:

Así es como se ve la página cuando se inspecciona en Chrome

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

const [button] = await frame.$x("/html/body/div/div[4]/div[2]/div/span[1]"); async function pop_up() { if (button) { await button.click(); } } document.getElementsByClassName("vtmBtn").addEventListener("click", (e) => { var img = document.createElement("img"); img.setAttribute("src", ""); // in the empty string put the path of the image you want e.target.appendChild(img); });
about 4 years ago · Juan Pablo Isaza Report

0

Pude resolver esto usando $eval de la siguiente manera:

 await frame.$eval('span[class=vtmBtn]', el => el.click());
about 4 years ago · Juan Pablo Isaza Report
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!