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

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

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 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