Skip to content

Conversation

thalissonvs
Copy link
Member

@thalissonvs thalissonvs commented Aug 27, 2025

Closes #119

This PR adds support for connecting using a WebSocket address, enabling remote browser control.

The API now works as follows:

chrome = Chrome()
tab = await chrome.connect(your_ws_address)
# and from here you have full access to all pydoll features

ConnectionHandler was also refactored to accept a URL directly, allowing hybrid automations. For example, you can create a ConnectionHandler instance for a specific target and then manually create a WebElement instance, as long as you have its object_id:

connection_handler = ConnectionHandler(ws_address=your_ws_address)
element = WebElement(object_id, connection_handler)

This way, you can use your own CDP implementation together with Pydoll, while still taking full advantage of our API.

TODO:

  • Create custom exceptions
  • Refactor some conditional logic
  • Remove unnecessary variables from Tab
  • Review typing
  • Add documentation

@thalissonvs thalissonvs self-assigned this Aug 27, 2025
@thalissonvs thalissonvs added the enhancement New feature or request label Aug 27, 2025
@autoscrape-labs autoscrape-labs deleted a comment from codecov bot Aug 27, 2025
@thalissonvs thalissonvs marked this pull request as draft August 27, 2025 01:30
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 98.86364% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pydoll/browser/tab.py 96.15% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thalissonvs thalissonvs marked this pull request as ready for review August 28, 2025 03:37
@thalissonvs thalissonvs merged commit f746476 into main Aug 28, 2025
20 of 21 checks passed
@thalissonvs thalissonvs deleted the feat/remote-cdp-connect branch August 28, 2025 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Connect to browser using the cdp

2 participants