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

[Bug]: browserContext.on('targetcreated', t => t.createCDPSession()) goes haywire #8787

Closed
stevenwdv opened this issue Aug 15, 2022 · 0 comments · Fixed by #8788 or #8769
Closed

[Bug]: browserContext.on('targetcreated', t => t.createCDPSession()) goes haywire #8787

stevenwdv opened this issue Aug 15, 2022 · 0 comments · Fixed by #8788 or #8769
Assignees

Comments

@stevenwdv
Copy link

Bug description

Steps to reproduce the problem:

const browser = await puppeteer.launch();
browser.browserContexts()[0].on('targetcreated', async target => {
	console.log(target.url());
	const cdp = await target.createCDPSession();
	// (do something with cdp)
});
await browser.newPage();

This prints 'about:blank' over and over.

Apparently Target#createCDPSession causes targetcreated to be fired again.
This is most likely caused by #8520 (so v16.0.0). The snippet worked correctly in v15.3.2.

Puppeteer version

16.1.0

Node.js version

18.7.0

npm version

8.15.1

What operating system are you seeing the problem on?

Windows

Relevant log output

about:blank
about:blank
about:blank
about:blank
about:blank
...
@stevenwdv stevenwdv added the bug label Aug 15, 2022
@stevenwdv stevenwdv changed the title [Bug]: browserContext.on('targetcreated', t => {console.log(t.url()); t.createCDPSession()}) goes haywire [Bug]: browserContext.on('targetcreated', t => t.createCDPSession()) goes haywire Aug 15, 2022
stevenwdv added a commit to stevenwdv/tracker-radar-collector that referenced this issue Aug 15, 2022
@OrKoN OrKoN self-assigned this Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants