Skip to content

Conversation

@juecd
Copy link
Contributor

@juecd juecd commented Jul 10, 2025

Description

Kernel browsers launch with a default context and page and don't play well with newContext() / newPage(). We have a note about this in our docs. Updates the sample apps so as to not send users down the wrong path.

Full context:
browser.newContext() only works when Playwright owns the browser (e.g. it was launched with chromium.launch() or when you attach with the full Playwright-protocol browserType.connect() API).
When you attach with connectOverCDP() you are talking to a running Chromium that Playwright did not launch; Chromium exposes only the existing “default” context to remote CDP clients and rejects attempts to create more contexts. The Playwright docs hint at this:
“The default browser context is accessible via browser.contexts()”

Implementation Checklist

  • n/a - Implemented this change in TypeScript
  • Implemented this change in Python

Testing

  • All tests pass locally
  • Linted

Additional Notes

Also resolves a conflicting Pydantic dependency in the cua app

@juecd juecd requested a review from heyglassy July 11, 2025 01:21
@juecd juecd marked this pull request as ready for review July 11, 2025 01:21
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Page Tracking Broken by Missing Event Listener

The refactoring removed the context.on("page", self._handle_new_page) event listener. This prevents the _handle_new_page method from being called when new pages are created, breaking page tracking functionality. Consequently, self._page will not be updated to new pages, and new pages will not have their close event handlers configured.

templates/python/cua/computers/default/kernel.py#L25-L32

https://github.com/onkernel/create-kernel-app/blob/0d42c86c4d886ac66b1baf3ca9f1ec7806110c9f/templates/python/cua/computers/default/kernel.py#L25-L32

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@juecd juecd merged commit 8b98f96 into main Jul 11, 2025
6 checks passed
@juecd juecd deleted the cj/context-pages branch July 11, 2025 01:29
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

Successfully merging this pull request may close these issues.

3 participants