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

192
Visualizações
Cypress - waiting for all jQuery requests to finish before proceeding to next step

I have come from a Selenium/Python background and I'm now learning Cypress.

In a nutshell, we have a visual regression tool that has to wait for everything on the page to completely load prior to taking a screenshot.

In my previous framework, I was able to use the following code to wait for a page to completely load that had jQuery requests and it worked.

def wait_for_page_to_load(self):
        """
        Waits for page to fully load
        """
        try:
            wait = WebDriverWait(self.driver, 10, 0.25)
            wait.until(
                lambda driver: driver.execute_script(
                    "return (window.jQuery != null) && (jQuery.active === 0);"
                )
            )
            self.log.info("Page has finished loading")
        except:
            e = sys.exc_info()[0]
            self.log.error(
                "### Exception occurred whilst waiting for page to load: %s", e
            )

Now that I am using Cypress, I don't know how to basically run the return line. I've searched google but so far no good.

I've played around with the following but no joy.

pageLoaded() {
        Cypress.$(document).ajaxStop(function () {
        })
    }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You may call the window object using cypress command cy.window().

cy.window().then(win => {
    // do something with win
});

But I believe it would be best to use commands cy.intercept() with cy.wait

// before the start of your test:
cy.intercept('GET', '/path/to/api/calls/1').as('apiCall1');

// During your test:
cy.visit('yourUrl');
cy.wait('@apiCall1');
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