Skip to content

Commit ca92a51

Browse files
authored
Merge pull request #4006 from seleniumbase/cdp-mode-patch-61
CDP Mode: Patch 61
2 parents d37267e + d9e3683 commit ca92a51

File tree

11 files changed

+35
-14
lines changed

11 files changed

+35
-14
lines changed

examples/cdp_mode/ReadMe.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ with SB(uc=True, test=True, ad_block=True) as sb:
283283
required_text = "Catan"
284284
sb.cdp.press_keys('input[aria-label="Search"]', search + "\n")
285285
sb.sleep(3.8)
286+
if sb.is_element_visible("#px-captcha"):
287+
sb.cdp.gui_click_and_hold("#px-captcha", 12)
288+
sb.sleep(3.2)
289+
if sb.is_element_visible("#px-captcha"):
290+
sb.cdp.gui_click_and_hold("#px-captcha", 12)
291+
sb.sleep(3.2)
286292
sb.cdp.remove_elements('[data-testid="skyline-ad"]')
287293
print('*** Walmart Search for "%s":' % search)
288294
print(' (Results must contain "%s".)' % required_text)

examples/cdp_mode/raw_footlocker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
sb.sleep(2.5)
77
sb.cdp.click_if_visible('button[id*="Agree"]')
88
sb.sleep(1.5)
9-
sb.cdp.mouse_click('input[aria-label="Search"]')
9+
sb.cdp.mouse_click('input[name="query"]')
1010
sb.sleep(1.5)
1111
search = "Nike Shoes"
12-
sb.cdp.press_keys('input[aria-label="Search"]', search)
12+
sb.cdp.press_keys('input[name="query"]', search)
1313
sb.sleep(2.5)
1414
sb.cdp.mouse_click('ul[id*="typeahead"] li div')
1515
sb.sleep(3.5)

examples/cdp_mode/raw_indeed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with SB(uc=True, test=True) as sb:
44
url = "https://www.indeed.com/companies/search"
55
sb.activate_cdp_mode(url)
6-
search_box = 'input[data-testid="company-search-box"]'
6+
search_box = "input#company-search"
77
if not sb.is_element_present(search_box):
88
sb.sleep(2)
99
sb.uc_gui_click_captcha()

examples/cdp_mode/raw_theaters.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
55
url = "https://architectureofcities.com/roman-theaters"
66
sb.activate_cdp_mode(url)
7+
sb.sleep(0.5)
78
sb.cdp.click_if_visible("#cn-close-notice")
9+
sb.cdp.click_if_visible('[aria-label="Reject All"]')
810
sb.cdp.click_if_visible('span:contains("Continue")')
911
sb.sleep(1)
1012
print("*** " + sb.cdp.get_text("h1") + " ***")

examples/cdp_mode/raw_walmart.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
required_text = "Catan"
1313
sb.cdp.press_keys('input[aria-label="Search"]', search + "\n")
1414
sb.sleep(3.8)
15+
if sb.is_element_visible("#px-captcha"):
16+
sb.cdp.gui_click_and_hold("#px-captcha", 12)
17+
sb.sleep(3.2)
18+
if sb.is_element_visible("#px-captcha"):
19+
sb.cdp.gui_click_and_hold("#px-captcha", 12)
20+
sb.sleep(3.2)
1521
sb.cdp.remove_elements('[data-testid="skyline-ad"]')
1622
print('*** Walmart Search for "%s":' % search)
1723
print(' (Results must contain "%s".)' % required_text)

examples/cdp_mode/raw_wsform.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
with SB(uc=True, test=True, locale="en", incognito=True) as sb:
44
url = "https://wsform.com/demo/"
55
sb.activate_cdp_mode(url)
6+
sb.sleep(1)
67
sb.scroll_into_view("div.grid")
78
sb.uc_gui_click_captcha()
8-
sb.sleep(1)
9+
sb.sleep(2)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ setuptools~=70.2;python_version<"3.10"
55
setuptools>=80.9.0;python_version>="3.10"
66
wheel>=0.45.1
77
attrs>=25.3.0
8-
certifi>=2025.8.3
8+
certifi>=2025.10.5
99
exceptiongroup>=1.3.0
1010
websockets~=13.1;python_version<"3.9"
1111
websockets>=15.0.1;python_version>="3.9"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.42.0"
2+
__version__ = "4.42.1"

seleniumbase/core/browser_launcher.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,8 @@ def _set_chrome_options(
26642664
included_disabled_features.append(item)
26652665
d_f_string = ",".join(included_disabled_features)
26662666
chrome_options.add_argument("--disable-features=%s" % d_f_string)
2667+
if proxy_auth:
2668+
chrome_options.add_argument("--test-type")
26672669
if (
26682670
is_using_uc(undetectable, browser_name)
26692671
and (
@@ -2681,7 +2683,8 @@ def _set_chrome_options(
26812683
chrome_options.add_argument("--disable-popup-blocking")
26822684
# Skip remaining options that trigger anti-bot services
26832685
return chrome_options
2684-
chrome_options.add_argument("--test-type")
2686+
if not proxy_auth:
2687+
chrome_options.add_argument("--test-type")
26852688
chrome_options.add_argument("--log-level=3")
26862689
chrome_options.add_argument("--no-first-run")
26872690
chrome_options.add_argument("--allow-insecure-localhost")

seleniumbase/undetected/cdp_driver/config.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ def __init__(
150150
"--disable-renderer-backgrounding",
151151
"--disable-background-networking",
152152
"--disable-dev-shm-usage",
153-
"--disable-features=IsolateOrigins,site-per-process,Translate,"
154-
"InsecureDownloadWarnings,DownloadBubble,DownloadBubbleV2,"
155-
"OptimizationTargetPrediction,OptimizationGuideModelDownloading,"
156-
"SidePanelPinning,UserAgentClientHint,PrivacySandboxSettings4,"
157-
"DisableLoadExtensionCommandLineSwitch",
158153
]
159154

160155
@property
@@ -202,7 +197,15 @@ def __call__(self):
202197
# By the time it starts, the port is probably already taken.
203198
args = self._default_browser_args.copy()
204199
args += ["--user-data-dir=%s" % self.user_data_dir]
205-
args += ["--disable-features=IsolateOrigins,site-per-process"]
200+
args += [
201+
"--disable-features=IsolateOrigins,site-per-process,Translate,"
202+
"InsecureDownloadWarnings,DownloadBubble,DownloadBubbleV2,"
203+
"OptimizationTargetPrediction,OptimizationGuideModelDownloading,"
204+
"SidePanelPinning,UserAgentClientHint,PrivacySandboxSettings4,"
205+
"DisableLoadExtensionCommandLineSwitch"
206+
]
207+
if self.proxy:
208+
args += ["--test-type"]
206209
args += ["--disable-session-crashed-bubble"]
207210
if self.expert:
208211
args += [

0 commit comments

Comments
 (0)