Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda