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.

Error: Navigating frame was detached

See original GitHub issue

Steps to reproduce

Environment:

Puppeteer 2.0.0; OS Windows 10; Node.js 12.0.0;

`const puppeteer = require(‘puppeteer’);

(async () => { const browser = await puppeteer.launch({ headless: false });

const page = await browser.newPage();
page.on('framenavigated', (frame) => {
    console.log('Frame navigated: ' + frame.name());
});

page.on('framedetached', (frame) => {
    console.log('Frame detached: ' + frame.name());
});

await page.goto('http://example.com');
await page.evaluate(() => {
    let iframe;
    iframe = document.createElement('iframe');
    iframe.name = 'my_frame';
    document.body.appendChild(iframe);
});

let frames = await page.frames();
let my_frame = frames[1];

try {
    await my_frame.goto('http://example.org');
} catch (error) {
    console.log(error);
}

try {
    await my_frame.goto('http://example.net');
} catch (error) {
    console.log(error);
}

await browser.close();

})();`

What is the expected result? Navigation should be completed without errors.

What happens instead? Error: Navigating frame was detached

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

17reactions
kblokcommented, Nov 27, 2019

@cssberries @dmnrmr could you try disabling the site-per-process flag?

const browser = await puppeteer.launch({headless: false, args: ['--disable-features=site-per-process']})
1reaction
dmnrmrcommented, Nov 27, 2019

I was struggling with similar problem (frame detaching) on version 2.0.0. For whatever reason iframe I was interested for was detaching, and page.frames() returned an empty array and at the same time iframe was still there in the dom. So downgrading to 1.19.0 fixed the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid 'frame got detached' error async validation or ...
The error that is thrown in the second scenario states waitForFunction failed: frame got detached . Which makes sense since the frame no ......
Read more >
How to handle detached iframes
Since detached iframes never navigate, we can simply use |window| itself instead of window->frame()->domWindow().
Read more >
Frame class - puppeteer library - Dart API
Page.onFrameNavigated - fired when the frame commits navigation to a different URL. Page.onFrameDetached - fired when the frame gets detached from the page....
Read more >
fix(navigation): waitForNavigation to pick up aborted ... - Gitnet
// When frame was detached during load, "cancelled" comes before detach. // Ignore it and hope for the best ...
Read more >
Working with IFrames and frames
However, if there are no buttons outside of the iframe, you might instead get a no such element error. This happens because Selenium...
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