Skip to content

CDP Mode: Patch 52 #3910

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
Aug 2, 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
2 changes: 2 additions & 0 deletions examples/cdp_mode/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ sb.cdp.send_keys(selector, text, timeout=None)
sb.cdp.press_keys(selector, text, timeout=None)
sb.cdp.type(selector, text, timeout=None)
sb.cdp.set_value(selector, text, timeout=None)
sb.cdp.clear_input(selector, timeout=None)
sb.cdp.clear(selector, timeout=None)
sb.cdp.submit(selector)
sb.cdp.evaluate(expression)
sb.cdp.js_dumps(obj_name)
Expand Down
10 changes: 5 additions & 5 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# mkdocs dependencies for generating the seleniumbase.io website
# Minimum Python version: 3.9 (for generating docs only)

regex>=2024.11.6
pymdown-extensions>=10.16
pipdeptree>=2.27.0
regex>=2025.7.34
pymdown-extensions>=10.16.1
pipdeptree>=2.28.0
python-dateutil>=2.8.2
Markdown==3.8.2
click==8.2.1
click==8.2.2
ghp-import==2.1.0
watchdog==6.0.0
cairocffi==1.7.1
pathspec==0.12.1
Babel==2.17.0
paginate==0.5.7
mkdocs==1.6.1
mkdocs-material==9.6.15
mkdocs-material==9.6.16
mkdocs-exclude-search==0.6.6
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.3.1
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip>=25.0.1;python_version<"3.9"
pip>=25.1.1;python_version>="3.9"
pip>=25.2;python_version>="3.9"
packaging>=25.0
setuptools~=70.2;python_version<"3.10"
setuptools>=80.9.0;python_version>="3.10"
Expand Down Expand Up @@ -71,13 +71,13 @@ pyotp==2.9.0
python-xlib==0.33;platform_system=="Linux"
markdown-it-py==3.0.0
mdurl==0.1.2
rich>=14.0.0,<15
rich>=14.1.0,<15

# --- Testing Requirements --- #
# ("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.2;python_version>="3.9"
coverage>=7.10.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.40.6"
__version__ = "4.40.7"
2 changes: 2 additions & 0 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ def uc_open_with_cdp_mode(driver, url=None, **kwargs):
cdp.send_keys = CDPM.send_keys
cdp.press_keys = CDPM.press_keys
cdp.type = CDPM.type
cdp.clear_input = CDPM.clear_input
cdp.clear = CDPM.clear_input
cdp.set_value = CDPM.set_value
cdp.submit = CDPM.submit
cdp.evaluate = CDPM.evaluate
Expand Down
10 changes: 10 additions & 0 deletions seleniumbase/core/sb_cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,16 @@ def type(self, selector, text, timeout=None):
self.__slow_mode_pause_if_set()
self.loop.run_until_complete(self.page.sleep(0.025))

def clear_input(self, selector, timeout=None):
if not timeout:
timeout = settings.SMALL_TIMEOUT
self.__slow_mode_pause_if_set()
element = self.select(selector, timeout=timeout)
element.scroll_into_view()
element.clear_input()
self.__slow_mode_pause_if_set()
self.loop.run_until_complete(self.page.sleep(0.025))

def set_value(self, selector, text, timeout=None):
"""Similar to send_keys(), but clears the text field first."""
if not timeout:
Expand Down
3 changes: 3 additions & 0 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,9 @@ def clear(self, selector, by="css selector", timeout=None):
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
selector, by = self.__recalculate_selector(selector, by)
if self.__is_cdp_swap_needed():
self.cdp.clear_input(selector)
return
if self.__is_shadow_selector(selector):
self.__shadow_clear(selector, timeout)
return
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
python_requires=">=3.8",
install_requires=[
'pip>=25.0.1;python_version<"3.9"',
'pip>=25.1.1;python_version>="3.9"',
'pip>=25.2;python_version>="3.9"',
'packaging>=25.0',
'setuptools~=70.2;python_version<"3.10"', # Newer ones had issues
'setuptools>=80.9.0;python_version>="3.10"',
Expand Down Expand Up @@ -219,7 +219,7 @@
'python-xlib==0.33;platform_system=="Linux"',
'markdown-it-py==3.0.0',
'mdurl==0.1.2',
'rich>=14.0.0,<15',
'rich>=14.1.0,<15',
],
extras_require={
# pip install -e .[allure]
Expand All @@ -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.2;python_version>="3.9"',
'coverage>=7.10.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