-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Use Case: I need to connect to an existing page created in another process to create an end-to-end test.
The way I do this right now is by using launchServer
in the first process and sending the wsEndpoint
and page._delegate._targetId
to the second process. Then I create a WebSocket
manually in the second process that uses Target.attachToTarget
to connect to the page.
Feature Request:
- Expose page.targetId()
- Allow passing targetId to browser.newBrowserCDPSession(targetId?: string);
Proposed Usage:
Process A.
const server = await playwright.chromium.launchServer();
const browser = await playwright.chromium.connect({
wsEndpoint: server.wsEndpoint(),
});
const context = await browser.newContext();
const page = await context.newPage();
sendToProcessB({
targetId: page.targetId(),
wsEndpoint,
})
Process B.
const { targetId, wsEndpoint } = receiveFromProcessA();
const browser = await playwright.chromium.connect({ wsEndpoint });
const session = await browser.newBrowserCDPSession(targetId);
Metadata
Metadata
Assignees
Labels
No labels