question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to prevent/stop loading 'Page load'

See original GitHub issue

Well I try to stop to load the xhr and continue my test without page load time out error but not working and not even stop the xhr loading. Please guide if im using in correct way or it is actual bug.

cy.window((win) => {
  win.stop()
})

Try with black list as well in cypress.json file but did not work

"blacklistHosts": [
  "https://www.deepl.com/PHP/backend/docTrans.php?request_type=jsonrpc&il=en"
]

this is xhr I want to stop loading “https://www.deepl.com/PHP/backend/docTrans.php?request_type=jsonrpc&il=en

Reason why I need this because these is 1 xhr that will load after 5 seconds and this is never ending process in my application under test.

cy version 4.4.0 OS windows 10

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:33 (6 by maintainers)

github_iconTop GitHub Comments

31reactions
manasaj111commented, Jun 10, 2021

I found a work around here - #14857

cy.window().document().then(function (doc) {
  doc.addEventListener('click', () => {
    setTimeout(function () { doc.location.reload() }, 5000)
  })
  cy.get('[ng-click="vm.export()"]').click()
})

Thanks to Sarja 👍

13reactions
norvininocommented, Sep 25, 2020

Clicking this download link works fine, but I can’t stop cypress from waiting for a nonexistant page to load, which prevents the rest of the test from running. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to prevent/stop loading 'Page load' in Cypress when ...
In my Cypress test, I need to test a link which downloads a .txt, .xlsx and a .zip file when clicked, but when...
Read more >
visit - Cypress Documentation
Prevent requests before a remote page initially loads. One common scenario Cypress supports is visiting a remote page and also preventing any Ajax...
Read more >
Stopping a page element from loading - Google Groups
I have a site I go to frequently that has a massive JavaScript menu that loads up in some DIV content. It seriously...
Read more >
How to show Page Loading div until the page has finished ...
When document.readyState changes, readystatechange event fires and our function executes. If the document is not yet loaded then the body should ...
Read more >
Window.stop() - Web APIs - MDN Web Docs
The window.stop() stops further resource loading in the current browsing context, equivalent to the stop button in the browser.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found