[Feature] Allow reconnecting to page in a separate processes
See original GitHub issueUse 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);
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Reconnecting to Shiny apps - R Shiny - RStudio
To enable new-session reconnections, put session$allowReconnect(TRUE) somewhere in the server function. For example:.
Read more >Remote Desktop client disconnects and can't reconnect to the ...
Troubleshooting an issue in which remote desktop client disconnects and can't reconnect to the same session.
Read more >How to reconnect to a disconnected ssh session - Server Fault
When you first log in, run screen. You get another shell, run commands in that. If you're disconnected, the screen process keeps the...
Read more >How to reconnect to websocket after close connection [duplicate]
The reason I want to do this is to allow users to stop sending data to the web temporary, and resending again after...
Read more >Thread text among frames in Adobe InDesign
Connected frames can be on the same page or spread, or on another page in the document. The process of connecting text among...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kababoom I think you are talking about https://github.com/microsoft/playwright/issues/1745. I’m closing the session reconnect aspect for now.
New to playwright, thank you for your time and effort creating this…
I’m also looking for a way to reconnect to a previously created session to cover my end-to-end testcases.
So Login.js should continue with previously created Openpage.js session.
This would be the only way to integrate playwrite inside our existing framework and I’m not able to get this to work (yet).