Skip to content

CDP Mode: Patch 50 #3830

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

Merged
merged 3 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/cdp_mode/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ sb.cdp.get_navigation_history()
sb.cdp.tile_windows(windows=None, max_columns=0)
sb.cdp.grant_permissions(permissions, origin=None)
sb.cdp.grant_all_permissions()
sb.cdp.reset_permissions()
sb.cdp.get_all_cookies(*args, **kwargs)
sb.cdp.set_all_cookies(*args, **kwargs)
sb.cdp.save_cookies(*args, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setuptools~=70.2;python_version<"3.10"
setuptools>=80.9.0;python_version>="3.10"
wheel>=0.45.1
attrs>=25.3.0
certifi>=2025.4.26
certifi>=2025.6.15
exceptiongroup>=1.3.0
websockets~=13.1;python_version<"3.9"
websockets>=15.0.1;python_version>="3.9"
Expand Down Expand Up @@ -77,7 +77,7 @@ rich>=14.0.0,<15
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)

coverage>=7.6.1;python_version<"3.9"
coverage>=7.9.0;python_version>="3.9"
coverage>=7.9.1;python_version>="3.9"
pytest-cov>=5.0.0;python_version<"3.9"
pytest-cov>=6.2.1;python_version>="3.9"
flake8==5.0.4;python_version<"3.9"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.39.4"
__version__ = "4.39.5"
1 change: 1 addition & 0 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ def uc_open_with_cdp_mode(driver, url=None, **kwargs):
cdp.tile_windows = CDPM.tile_windows
cdp.grant_permissions = CDPM.grant_permissions
cdp.grant_all_permissions = CDPM.grant_all_permissions
cdp.reset_permissions = CDPM.reset_permissions
cdp.get_all_cookies = CDPM.get_all_cookies
cdp.set_all_cookies = CDPM.set_all_cookies
cdp.save_cookies = CDPM.save_cookies
Expand Down
7 changes: 7 additions & 0 deletions seleniumbase/core/sb_cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ def grant_all_permissions(self):
driver = driver.cdp_base
return self.loop.run_until_complete(driver.grant_all_permissions())

def reset_permissions(self):
"""Reset permissions for all origins on the current window."""
driver = self.driver
if hasattr(driver, "cdp_base"):
driver = driver.cdp_base
return self.loop.run_until_complete(driver.reset_permissions())

def get_all_cookies(self, *args, **kwargs):
driver = self.driver
if hasattr(driver, "cdp_base"):
Expand Down
4 changes: 4 additions & 0 deletions seleniumbase/undetected/cdp_driver/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ async def grant_all_permissions(self):
]
await self.connection.send(cdp.browser.grant_permissions(permissions))

async def reset_permissions(self):
"""Reset permissions for all origins on the current window."""
await self.connection.send(cdp.browser.reset_permissions())

async def tile_windows(self, windows=None, max_columns: int = 0):
import math
try:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
'setuptools>=80.9.0;python_version>="3.10"',
'wheel>=0.45.1',
'attrs>=25.3.0',
"certifi>=2025.4.26",
"certifi>=2025.6.15",
"exceptiongroup>=1.3.0",
'websockets~=13.1;python_version<"3.9"',
'websockets>=15.0.1;python_version>="3.9"',
Expand Down Expand Up @@ -234,7 +234,7 @@
# Usage: coverage run -m pytest; coverage html; coverage report
"coverage": [
'coverage>=7.6.1;python_version<"3.9"',
'coverage>=7.9.0;python_version>="3.9"',
'coverage>=7.9.1;python_version>="3.9"',
'pytest-cov>=5.0.0;python_version<"3.9"',
'pytest-cov>=6.2.1;python_version>="3.9"',
],
Expand Down