Skip to content

Conversation

@karlseguin
Copy link
Collaborator

CDP currently assumes that if we get a page-related notification (like a request interception, or page lifecycle event), then we must have a session and page.

But, Target.detachFromTarget can remove the session from the BrowserContext while still having the page run (I wonder if we should stop the page at this point??). So, remove these assumptions and make sure we have a page/session in the handling of page events.

CDP currently assumes that if we get a page-related notification (like a
request interception, or page lifecycle event), then we must have a session
and page.

But, Target.detachFromTarget can remove the session from the BrowserContext
while still having the page run (I wonder if we should stop the page at this
point??). So, remove these assumptions and make sure we have a page/session
in the handling of page events.
@krichprollsch
Copy link
Member

I wonder if we should stop the page at this point?

I think we could detach and re-attach immediately to the same target.
So keeping the page is a good thing.

I agree to return if session_id is missing, It think it's the good way to do.

@krichprollsch krichprollsch merged commit 42828c6 into main Sep 5, 2025
10 checks passed
@krichprollsch krichprollsch deleted the cdp_detached branch September 5, 2025 08:19
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants