-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Question] CDP sessions with other targets #4286
Comments
Thanks for the report @Altneuj. Playwright APIs are different to accommodate cross-browser support. I would encourage not using CDP, since it is a moving target and incompatible with other browsers. We could consider Playwright API support for the protocol messages. Emulating network conditions was discussed in #3393. If this sounds valuable, it would be useful to know what protocol messages are sent over CDP and find Playwright API equivalents. If using CDP is a hard requirement, we would need to explore accepting |
Wow, thank you for such a quick response. CDP was just the easiest as that is how we had it with puppeteer. I will look into other options as it makes sense not to have something that isn't supported by all browsers. Thanks! |
@Altneuj I'm having the same problem. I like to establish a CDPSession with a service worker in order to send |
Hello! I am working on some E2E tests using playwright transitioning over from puppeteer.
In the puppeteer test we find the service worker target via
page.browser().targets()
and find bytype
. After finding the service worker target we open a CDPSession with itserviceWorkerTarget.createCDPSession
and can thensend
different protocols directly to it such as aNetwork.emulateNetworkConditions
.With playwright I am able to create a CDPSession with the playwright page and can see the service worker target and
targetId
when sendingTarget.getTargets
, however I am unable to set up a session directly with the service worker after this. I have triedTarget.AttachToTarget
with the service worker targetid but don't see a way to use that session directly. Any idea how I could set up a CDP session directly with service worker?I have also tried using WebSocket directly via this guide https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md however I am getting a target closed error when attempting to
Target.getTargets
am not sure if playwright chromium instance is doing some sort of blocking there.Thank you!
The text was updated successfully, but these errors were encountered: