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

280
Visualizações
My 'waits' don't work properly in webdriverIO
describe("Purge all", function() {    
    it('Purge all', () => {      
        CachePurgePage.open(PARTNER_ID, ACCOUNT_ID, CONFIGURATION_ID);
        const label = $('[class = "css-1av0y7f-SidebarLinkTitle ezsph7p1"]');

        browser.waitUntil(function(){
            return label.isClickable()
        }, 6000, "Element is not clickable");
        label.click();

        browser.waitUntil(function(){
            return $$('[class ="css-1rqefwa-LabelOutput e9gmw1r4"]')[1].isDisplayed();
        }, 6000, "Element is not displayed")
        $$('[class ="css-1rqefwa-LabelOutput e9gmw1r4"]')[1].click();

        browser.waitUntil(function(){
            return $$('[class *= "Row-StyledTableRow"]')[1].isDisplayed();
        }, 6000, "Element is not clickable")

        const firstTR = CachePurgePage.tableTasksInfo[0];
        const internalTDs = firstTR.$$('[class = "css-zr137n-Cell eveacmn0"]');
        expect(internalTDs[1]).toHaveText('2');

Hi all! My first WDIO test and it's not hard to understand I am new in it. So I came across an interesting problem. The test is working fine when I use browser.pause() but if I only try to implement $element.waitForClickable().click() everething is going wrong. The test doesn't wait for conditions and try to find an element anyway and then click it. Of course he doesn't find anything because the needed page hasn't been downloaded and just click "undefine" element that results in ending the test with error. So I tried browser.waitUntil() and some unexpected steps was going on. First the browser searches for "label = $('[class = "css-1av0y7f-SidebarLinkTitle ezsph7p1"]')" and then click it. The terminal output says that everything is OK. Then starts searching for "$$('[class ="css-1rqefwa-LabelOutput e9gmw1r4"]')[1]" and can't locate it cause IRL the click() on the previous element didn't happen. I can't understand why it's working this way. I have 94 chromedriver, 7.14 wdio and 14 node.js and tried it on 85 chromedriver, 6.7 wdio and 12 node.js there are no any differences

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Check the examples here: https://webdriver.io/docs/api/browser/waitUntil/

You will notice that you are missing async/await notations.

Basically browser.waitUntil returns a Promise() which you are just ignoring.

since NodeJs v16 sync. mode is deprecated: sync. mode warning


Try this:

describe("Purge all", function() {    
    it('Purge all', async () => {      
        CachePurgePage.open(PARTNER_ID, ACCOUNT_ID, CONFIGURATION_ID);
        const label = $('[class = "css-1av0y7f-SidebarLinkTitle ezsph7p1"]');

        await browser.waitUntil(function(){
            return label.isClickable()
        }, 6000, "Element is not clickable");
        label.click();

        await browser.waitUntil(function(){
            return $$('[class ="css-1rqefwa-LabelOutput e9gmw1r4"]')[1].isDisplayed();
        }, 6000, "Element is not displayed")
        $$('[class ="css-1rqefwa-LabelOutput e9gmw1r4"]')[1].click();

        await browser.waitUntil(function(){
            return $$('[class *= "Row-StyledTableRow"]')[1].isDisplayed();
        }, 6000, "Element is not clickable")

        const firstTR = CachePurgePage.tableTasksInfo[0];
        const internalTDs = firstTR.$$('[class = "css-zr137n-Cell eveacmn0"]');
        expect(internalTDs[1]).toHaveText('2');
    //...

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