Skip to content
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
4 changes: 2 additions & 2 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# mkdocs dependencies for generating the seleniumbase.io website
# Minimum Python version: 3.10 (for generating docs only)

regex>=2026.2.28
pymdown-extensions>=10.21
regex>=2026.3.32
pymdown-extensions>=10.21.2
pipdeptree>=2.34.0
python-dateutil>=2.8.2
Markdown==3.10.2
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ parse>=1.21.1
parse-type>=0.6.6
colorama>=0.4.6
pyyaml>=6.0.3
pygments>=2.19.2
pygments>=2.20.0
pyreadline3>=3.5.4;platform_system=="Windows"
tabcompleter>=1.4.0
pdbp>=1.8.2
Expand All @@ -33,7 +33,7 @@ charset-normalizer>=3.4.6,<4
urllib3>=1.26.20,<2;python_version<"3.10"
urllib3>=1.26.20,<3;python_version>="3.10"
requests~=2.32.5;python_version<"3.10"
requests~=2.33.0;python_version>="3.10"
requests~=2.33.1;python_version>="3.10"
sniffio==1.3.1
h11==0.16.0
outcome==1.3.0.post0
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.47.8"
__version__ = "4.47.9"
6 changes: 5 additions & 1 deletion seleniumbase/core/sb_cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,11 @@ def press_keys(self, selector, text, timeout=None):
):
text = text.replace("\n", "\r")
for key in text:
element.send_keys(key)
try:
element.send_keys(key)
except AttributeError:
element = self.select(selector, timeout=0.1)
element.send_keys(key)
time.sleep(float(0.042 + (random.random() / 110.0)))
if submit:
element.send_keys("\r\n")
Expand Down
50 changes: 36 additions & 14 deletions seleniumbase/undetected/cdp_driver/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
import os
import pathlib
Expand Down Expand Up @@ -88,19 +89,19 @@ def __init__(
if not browser_args:
browser_args = []
if not user_data_dir:
self.user_data_dir = temp_profile_dir()
self.user_data_dir = temp_profile_dir(proxy=proxy)
self._user_data_dir = self.user_data_dir
self._custom_data_dir = False
else:
self.user_data_dir = user_data_dir
profile = os.path.join(self.user_data_dir, "Default")
preferences_file = os.path.join(profile, "Preferences")
preferences = get_default_preferences()
preferences = get_default_preferences(proxy=proxy)
if not os.path.exists(profile):
with suppress(Exception):
os.makedirs(profile)
with open(preferences_file, "w") as f:
f.write(preferences)
with open(preferences_file, "w", encoding="utf-8") as f:
json.dump(preferences, f)
mock_keychain = False
if not browser_executable_path:
browser_executable_path = find_chrome_executable()
Expand Down Expand Up @@ -343,25 +344,46 @@ def is_root():
return ctypes.windll.shell32.IsUserAnAdmin() != 0


def get_default_preferences():
return (
"""{"credentials_enable_service": false,
"password_manager_enabled": false,
"password_manager_leak_detection": false}"""
)
def get_default_preferences(proxy=None):
prefs = {
"profile": {
"password_manager_leak_detection": False,
"password_manager_enabled": False
},
"credentials_enable_service": False,
"omnibox-max-zero-suggest-matches": 0,
"omnibox-zero-suggest-prefetching": 0,
"omnibox-zero-suggest-prefetching-on-srp": 0,
"omnibox-zero-suggest-prefetching-on-web": 0,
"omnibox-zero-suggest-in-memory-caching": 0,
"local_discovery": {
"notifications_enabled": False
},
"autofill": {
"profile_enabled": False,
"credit_card_enabled": False
}
}
if proxy:
prefs["webrtc"] = {
"ip_handling_policy": "disable_non_proxied_udp",
"multiple_routes_enabled": False,
"nonproxied_udp_enabled": False
}
return prefs


def temp_profile_dir():
def temp_profile_dir(proxy=None):
"""Generate a temp dir (path)"""
path = os.path.normpath(tempfile.mkdtemp(prefix="uc_"))
profile = os.path.join(path, "Default")
preferences_file = os.path.join(profile, "Preferences")
preferences = get_default_preferences()
preferences = get_default_preferences(proxy=proxy)
if not os.path.exists(profile):
with suppress(Exception):
os.makedirs(profile)
with open(preferences_file, "w") as f:
f.write(preferences)
with open(preferences_file, "w", encoding="utf-8") as f:
json.dump(preferences, f)
return path


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
'parse-type>=0.6.6',
'colorama>=0.4.6',
'pyyaml>=6.0.3',
'pygments>=2.19.2',
'pygments>=2.20.0',
'pyreadline3>=3.5.4;platform_system=="Windows"',
'tabcompleter>=1.4.0',
'pdbp>=1.8.2',
Expand All @@ -181,7 +181,7 @@
'urllib3>=1.26.20,<2;python_version<"3.10"',
'urllib3>=1.26.20,<3;python_version>="3.10"',
'requests~=2.32.5;python_version<"3.10"',
'requests~=2.33.0;python_version>="3.10"',
'requests~=2.33.1;python_version>="3.10"',
'sniffio==1.3.1',
'h11==0.16.0',
'outcome==1.3.0.post0',
Expand Down