Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol error (Page.createIsolatedWorld): Could not create isolated world #4097

Closed
Filipoliko opened this issue Mar 2, 2019 · 2 comments
Closed

Comments

@Filipoliko
Copy link

Filipoliko commented Mar 2, 2019

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.12.x
  • Platform / OS version: Windows 7, Linux Ubuntu
  • URLs (if applicable):
  • Node.js version: 10

What steps will reproduce the problem?

The bug seems to be a little bit random, but it probably has something to do with links opening new tabs/windows. Here is script, which reproduces the error after some time. I was able to reproduce this error on 2 websites. The example script clicks on icon which opens a new window and then it closes the window. The error occuress when calling await browser.pages(). This error does not happen with puppeteer version <= 1.11.0.

const puppeteer = require('puppeteer');

puppeteer.launch({
	defaultViewport: {
		width: 1280,
		height: 720
	},
	headless: true
}).then(async browser => {
	let page = (await browser.pages())[0];
	await page.goto('https://www.seznam.cz/');

	for (let i = 0; i < 15; i++) {
		console.log('Round', i);
		await page.click('.timeline-article-footer__recommend-icon');
		await page.waitFor(500);
		await page.bringToFront();
		// Following line may throw an error
		let pages = await browser.pages();
		await pages[1].close();
	}

	await browser.close();
});

What is the expected result?
Everything is fine.

What happens instead?
browser.pages() throws following error:

Error: Protocol error (Page.createIsolatedWorld): Could not create isolated world
    at Promise (C:\Seznam\puperr\node_modules\puppeteer\lib\Connection.js:183:56)
    at new Promise (<anonymous>)
    at CDPSession.send (C:\Seznam\puperr\node_modules\puppeteer\lib\Connection.js:182:12)
    at Promise.all.frames.map.frame (C:\Seznam\puperr\node_modules\puppeteer\lib\FrameManager.js:259:63)
    at Array.map (<anonymous>)
    at FrameManager._ensureIsolatedWorld (C:\Seznam\puperr\node_modules\puppeteer\lib\FrameManager.js:259:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)

  -- ASYNC --
    at Target.<anonymous> (C:\Seznam\puperr\node_modules\puppeteer\lib\helper.js:108:27)
    at Promise.all.targets.filter.map.target (C:\Seznam\puperr\node_modules\puppeteer\lib\Browser.js:307:35)
    at Array.map (<anonymous>)
    at BrowserContext.pages (C:\Seznam\puperr\node_modules\puppeteer\lib\Browser.js:307:14)
    at BrowserContext.<anonymous> (C:\Seznam\puperr\node_modules\puppeteer\lib\helper.js:109:23)
    at Promise.all.browserContexts.map.context (C:\Seznam\puperr\node_modules\puppeteer\lib\Browser.js:233:90)
    at Array.map (<anonymous>)
    at Browser.pages (C:\Seznam\puperr\node_modules\puppeteer\lib\Browser.js:233:67)
    at Browser.<anonymous> (C:\Seznam\puperr\node_modules\puppeteer\lib\helper.js:109:23)
    at puppeteer.launch.then (C:\Seznam\puperr\index.js:18:29)

Hopefully, this will be enough for you to reproduce the error. It seems to be related to #2671

@aslushnikov
Copy link
Contributor

@Filipoliko thanks for filing! I can easily reproduce with the following script:

const puppeteer = require('puppeteer');

puppeteer.launch({
  defaultViewport: {
    width: 1280,
    height: 720
  },
  headless: true
}).then(async browser => {
  let page = (await browser.pages())[0];
  await page.goto('https://www.seznam.cz/', {waitUntil: 'domcontentloaded'});

  for (let i = 0; i < 110; i++) {
    console.log('Round', i);
    const icon = await page.waitFor('.timeline-article-footer__recommend-icon');
    const [popup] = await Promise.all([
      new Promise(x => page.once('popup', x)),
      icon.click(),
    ]);
    await popup.close();
  }
  await browser.close();
});

This turns out to be a dupe of #4011; it's already fixed upstream in chromium and will be fixed in the next release.

@Filipoliko
Copy link
Author

Glad to hear that, thank you and sorry for the duplicit issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants