Skip to content

[BUG] Error: Duplicate target when trying to connectOverCDP next time #5648

Closed

Description

Great work on connectOverCDP 👍 I am loving the ability to connect to an existing instance rather than launch a new chrome every time.

Context:

  • Playwright Version: 1.9.1
  • Operating System: Mac
  • Node.js version: 12.x
  • Browser: Chromium

Code Snippet

const { chromium } = require("playwright");

(async () => {
	const browser = await chromium.connectOverCDP({
                // NOTE: change this with ws URL by launching chrome with CDP
		wsEndpoint: `ws://127.0.0.1: 56685/devtools/browser/a5d5af82-e168-4ebb-8b87-199c3e5dc260`,
	});
	const contexts = browser.contexts();
	const browserContext = contexts[0];
	const page = await browserContext.newPage();
	await page.goto("https://playwright.dev");
})();

Describe the bug
Error log:

[1] app: 2021-02-28T03:57:53.593Z app:debug 1614484673593 -> Chrome Endpoint: ws://127.0.0.1:56685/devtools/browser/a5d5af82-e168-4ebb-8b87-199c3e5dc260
[1] app: 2021-02-28T03:57:53.643Z app:warn 1614484673641 -> Error: Duplicate target 3E6BA14AC5D3C8825FC23623D1B55050
[1] app:     at Object.assert (/Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/utils/utils.js:80:15)
[1] app:     at CRBrowser._onAttachedToTarget (/Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/server/chromium/crBrowser.js:152:17)
[1] app:     at CRSession.emit (events.js:315:20)
[1] app:     at CRSession.EventEmitter.emit (domain.js:483:12)
[1] app:     at /Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/server/chromium/crConnection.js:157:22
[1] app:     at runNextTicks (internal/process/task_queues.js:62:5)
[1] app:     at processImmediate (internal/timers.js:429:9) Promise { <rejected> Error: Duplicate target 3E6BA14AC5D3C8825FC23623D1B55050 at Object.assert (/Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/utils/utils.js:80:15) at CRBrowser._onAttachedToTarget (/Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/server/chromium/crBrowser.js:152:17) at CRSession.emit (events.js:315:20) at CRSession.EventEmitter.emit (domain.js:483:12) at /Users/vikramtiwari/Documents/code/app/packages/node_modules/playwright/lib/server/chromium/crConnection.js:157:22 at runNextTicks (internal/process/task_queues.js:62:5) at processImmediate (internal/timers.js:429:9) }

First time connection works properly but next time I try to connect to same WS URL, I see this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions