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

[Question] Why does chromiumBrowserContext.newCDPSession require a page? #3962

Closed
VikramTiwari opened this issue Sep 23, 2020 · 3 comments
Closed

Comments

@VikramTiwari
Copy link

I used to use CRBrowserContext._browser which is not available any more. Rather we have chromiumBrowserContext.newCDPSession(page) which requires a page. I retrofitted to pass in a page and the resultant session did the job properly but I am unsure why that page is required. Looking at the code it seems like the session is created relative to the page. Does this mean that session will be closed if that page is closed? Should there be a different call chromiumBrowserContext.newBrowserCDPSession() which doesn't require a page?

@pavelfeldman
Copy link
Member

That depends on the target you intend to attach to. If you need a session to a page, you pass the page in, if you want to attach to the browser, you use the newBrowserCDPSession.

@VikramTiwari
Copy link
Author

@pavelfeldman That makes sense. However I am launching browser using browserType.launchPersistentContext. With that newBrowserCDPSession is not available with chromiumBrowserContext. I also didn't see a way to get browser from browserContext. So this leaves me with just newCDPSession(page) which doesn't seem ideal.

@dgozman
Copy link
Contributor

dgozman commented Oct 1, 2020

Closing since the question is resolved.

@dgozman dgozman closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants