All event handlers are cleaned after the document.open function call
See original GitHub issueWhat is your Test Scenario?
Testing Google Apps Script web app, which adds two levels of iframe to your content.
What is the Current behavior?
Test hangs on await Selector(..)()
What is the Expected behavior?
Test runs normally
What is your web application and your TestCafe test code?
Your website URL (or attach your complete example): https://script.google.com/macros/s/AKfycbznLgTmhAx4iz4tdfY__7I_326s3ZLqWQaR3HKoJi37R0U4OcM/exec
Your complete test code (or attach your test files):
fixture`Testcafe nested iframe freezing issue repro`
.page('https://script.google.com/macros/s/AKfycbznLgTmhAx4iz4tdfY__7I_326s3ZLqWQaR3HKoJi37R0U4OcM/exec');
import { Selector } from 'testcafe';
test('It stucks on nested iframe selector', async t => {
await t
.switchToIframe('#sandboxFrame')
.switchToIframe('#userHtmlFrame');
await Selector('#helloworld')();
console.log("This is never logged as it's stuck");
});
Your complete test report:
None.Steps to Reproduce:
- Run the test
- See the test hangs
Your Environment details:
- testcafe version: 0.23.2
- node.js version: v11.2.0
- command-line arguments: testcafe chrome test.js
- browser name and version: Chrome 70.0.3538
- platform and version: Mac OS X 10.14.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
document.open removes all window listeners - Stack Overflow
The general idea is to setup a listener for a custom event called TestEvent , which clears a timeout.
Read more >Event handling (overview) - Event reference - MDN Web Docs
A notable event listener feature is the ability to use an abort signal to clean up multiple event handlers at the same time....
Read more >How to Cleanup Event Listeners in React - Pluralsight
Be a good citizen. Always cleanup your event listeners. Do this with window.removeEventListener when your component unmounts. By cleaning up, ...
Read more >Integration Services (SSIS) Event Handlers - Microsoft Learn
Event handlers can perform tasks such as the following: Clean up temporary data storage when a package or task finishes running.
Read more >Event listeners not working? 3 key areas to troubleshoot
addEventListener(EVENT_TYPE, function(event) { console.log( event.type, // The type of the event event.target, // The target of the event event, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The current workaround I’m using is to avoid using selector api and to use client functions like
t.eval(() => document.querySelector(....))
This is ugly, but is ok for my use case.🎉 🎉 🎉 🎉 🎉