Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!