Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
How to correctly expect the appearance of 'Select list'?

I need to press programmatically on button1, after pressing select list will appear and then on this select list i need to click on button2. id of button1 is #mx899, but on the web page i'm working on, you cannot use command for clicking, like document.querySelector('#mx899').click();, it does not work. You can call function sendEvent('click', 'mx899', ''); for clicking on button1, for clicking button2 you can call function sendEvent('click', 'mx3481[R:2]', ''); How to call these commands sequentially and alternately with one script? How to correctly expect the appearance of 'Select list'?

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

I tried to use Promise + async/await, but second click does not work, I think my code lacks a check for waiting to appear 'Select list'

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 Respuestas
Responde la pregunta

0

Since I dont have the code of the html form and I dont know why querySelector or getElementById are not availiable to you, I can only provide an approach and not a running solution. Buy you might adjust it towards your environment.

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
}

This code is NOT tested since I dont have the HTML code of the form!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda