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

188
Views
¿Cómo esperar correctamente la aparición de 'Lista de selección'?

Necesito presionar programáticamente en el botón 1, después de presionar aparecerá la lista de selección y luego en esta lista de selección necesito hacer clic en el botón 2. id de button1 es #mx899 , pero en la página web en la que estoy trabajando, no puede usar el comando para hacer clic, como document.querySelector('#mx899').click(); , No funciona. Puede llamar a la función sendEvent('click', 'mx899', ''); para hacer clic en el botón1, para hacer clic en el botón2 puede llamar a la función sendEvent('click', 'mx3481[R:2]', ''); ¿Cómo llamar a estos comandos de forma secuencial y alternativa con un script? ¿Cómo esperar correctamente la aparición de 'Lista de selección'?

 sendEvent('click', 'mx899', '');
 sendEvent('click', 'mx3481[R:2]', 'ev');

Traté de usar Promise + async/await, pero el segundo clic no funciona, creo que a mi código le falta un control para esperar a que aparezca 'Lista de selección'

 async function b() { function f1() { return new Promise(resolve => { resolve(sendEvent('click', 'mx899', '')); }) } function f2() { return new Promise(resolve => { resolve(sendEvent('click', 'mx3481[R:2]', '')); }) } async function myf() { let res1 = await f1(); let res2 = await f2(); return [res1,res2]; } return myf(); } b();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Como no tengo el código del formulario html y no sé por qué querySelector o getElementById no están disponibles para usted, solo puedo proporcionar un enfoque y no una solución en ejecución. Compre puede ajustarlo a su entorno.

 function performActions() { let element1 = document.getElementById('mx899'); // get the button element element1.click(); // send the click event to the button let handle = window.setInterval(function() { // create a timer... let element2 = document.getElementById('mx3481[R:2]'); // try to get the list element if (!element2) return; // When the list element is not found, return and try on next timer iteration element2.click(); // list element is found, send click event window.clearInterval(handle); // stop the timer }, 500); // ...that triggers every 500ms }

¡Este código NO está probado ya que no tengo el código HTML del formulario!

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!