Skip to content

Commit 9b24720

Browse files
authored
Merge pull request #4229 from seleniumbase/cdp-mode-patch-94
CDP Mode: Patch 94
2 parents ead4451 + f780a1d commit 9b24720

7 files changed

Lines changed: 42 additions & 18 deletions

File tree

examples/cdp_mode/playwright/raw_walmart_sync.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
item = items.nth(i)
2727
if required_text in item.inner_text():
2828
description = item.locator('[data-automation-id="product-title"]')
29-
if description and description.inner_text() not in unique_item:
29+
if (
30+
description
31+
and description.is_visible()
32+
and description.inner_text() not in unique_item
33+
):
3034
unique_item.append(description.inner_text())
3135
print("* " + description.inner_text())
3236
price = item.locator('[data-automation-id="product-price"]')

mkdocs_build/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ click==8.3.1
1010
ghp-import==2.1.0
1111
watchdog==6.0.0
1212
cairocffi==1.7.1
13-
pathspec==1.0.3
14-
Babel==2.17.0
13+
pathspec==1.0.4
14+
Babel==2.18.0
1515
paginate==0.5.7
1616
mkdocs==1.6.1
1717
mkdocs-material==9.6.23

requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pip>=25.3
1+
pip>=26.0
22
packaging>=26.0
33
setuptools~=70.2;python_version<"3.10"
44
setuptools>=80.10.2;python_version>="3.10"
@@ -45,7 +45,8 @@ wsproto~=1.3.2;python_version>="3.10"
4545
websocket-client~=1.9.0
4646
selenium==4.32.0;python_version<"3.10"
4747
selenium==4.40.0;python_version>="3.10"
48-
cssselect==1.3.0
48+
cssselect==1.3.0;python_version<"3.10"
49+
cssselect>=1.4.0,<2;python_version>="3.10"
4950
nest-asyncio==1.6.0
5051
sortedcontainers==2.4.0
5152
execnet==2.1.1;python_version<"3.10"
@@ -71,7 +72,7 @@ PyAutoGUI>=0.9.54;platform_system=="Linux"
7172
markdown-it-py==3.0.0;python_version<"3.10"
7273
markdown-it-py==4.0.0;python_version>="3.10"
7374
mdurl==0.1.2
74-
rich>=14.3.1,<15
75+
rich>=14.3.2,<15
7576

7677
# --- Testing Requirements --- #
7778
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)

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.46.2"
2+
__version__ = "4.46.3"

seleniumbase/core/sb_cdp.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,10 @@ def _on_a_cf_turnstile_page(self, source=None):
19741974

19751975
def _on_an_incapsula_hcaptcha_page(self, *args, **kwargs):
19761976
self.loop.run_until_complete(self.page.wait())
1977-
if self.is_element_visible('iframe[src*="_Incapsula_Resource?"]'):
1977+
if (
1978+
self.is_element_visible('iframe[src*="_Incapsula_Resource?"]')
1979+
or self.is_element_visible("iframe[data-hcaptcha-widget-id]")
1980+
):
19781981
return True
19791982
return False
19801983

@@ -2052,13 +2055,16 @@ def __gui_click_recaptcha(self, use_cdp=False):
20522055
return False
20532056

20542057
def __cdp_click_incapsula_hcaptcha(self):
2055-
selector = None
2058+
selector = "iframe[data-hcaptcha-widget-id]"
20562059
if self.is_element_visible('iframe[src*="_Incapsula_Resource?"]'):
20572060
outer_selector = 'iframe[src*="_Incapsula_Resource?"]'
2058-
selector = "iframe[data-hcaptcha-widget-id]"
20592061
element = self.get_nested_element(outer_selector, selector)
20602062
if not element:
20612063
return False
2064+
elif self.is_element_visible(selector):
2065+
element = self.select(selector, timeout=0.1)
2066+
if not element:
2067+
return False
20622068
else:
20632069
return False
20642070
time.sleep(0.05)

seleniumbase/undetected/cdp_driver/cdp_util.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,18 @@ async def start(
599599
sb_config.disable_csp = True
600600
if "binary_location" in kwargs and not browser_executable_path:
601601
browser_executable_path = kwargs["binary_location"]
602+
if not user_data_dir and "--user-data-dir" in arg_join:
603+
udd_string = None
604+
if "--user-data-dir=" in arg_join:
605+
udd_string = arg_join.split("--user-data-dir=")[1].split(" ")[0]
606+
elif "--user-data-dir " in arg_join:
607+
udd_string = arg_join.split("--user-data-dir ")[1].split(" ")[0]
608+
if udd_string:
609+
if udd_string.startswith('"') and udd_string.endswith('"'):
610+
udd_string = udd_string[1:-1]
611+
elif udd_string.startswith("'") and udd_string.endswith("'"):
612+
udd_string = udd_string[1:-1]
613+
user_data_dir = udd_string
602614
if not browser_executable_path:
603615
browser = None
604616
if "browser" in kwargs:
@@ -611,9 +623,9 @@ async def start(
611623
br_string = arg_join.split("--browser ")[1].split(" ")[0]
612624
if br_string:
613625
if br_string.startswith('"') and br_string.endswith('"'):
614-
br_string = proxy_string[1:-1]
626+
br_string = br_string[1:-1]
615627
elif br_string.startswith("'") and br_string.endswith("'"):
616-
br_string = proxy_string[1:-1]
628+
br_string = br_string[1:-1]
617629
browser = br_string
618630
if not browser:
619631
if "--edge" in sys_argv:

setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
],
147147
python_requires=">=3.9",
148148
install_requires=[
149-
'pip>=25.3',
149+
'pip>=26.0',
150150
'packaging>=26.0',
151151
'setuptools~=70.2;python_version<"3.10"', # Newer ones had issues
152152
'setuptools>=80.10.2;python_version>="3.10"',
@@ -193,7 +193,8 @@
193193
'websocket-client~=1.9.0',
194194
'selenium==4.32.0;python_version<"3.10"',
195195
'selenium==4.40.0;python_version>="3.10"',
196-
'cssselect==1.3.0',
196+
'cssselect==1.3.0;python_version<"3.10"',
197+
'cssselect>=1.4.0,<2;python_version>="3.10"',
197198
'nest-asyncio==1.6.0',
198199
'sortedcontainers==2.4.0',
199200
'execnet==2.1.1;python_version<"3.10"',
@@ -219,7 +220,7 @@
219220
'markdown-it-py==3.0.0;python_version<"3.10"',
220221
'markdown-it-py==4.0.0;python_version>="3.10"',
221222
'mdurl==0.1.2',
222-
'rich>=14.3.1,<15',
223+
'rich>=14.3.2,<15',
223224
],
224225
extras_require={
225226
# pip install -e .[allure]
@@ -261,7 +262,7 @@
261262
"pdfminer": [
262263
'pdfminer.six==20251107;python_version<"3.10"',
263264
'pdfminer.six==20260107;python_version>="3.10"',
264-
'cryptography==46.0.3',
265+
'cryptography==46.0.4',
265266
'cffi==2.0.0',
266267
'pycparser==2.23;python_version<"3.10"',
267268
'pycparser==3.0;python_version>="3.10"',
@@ -287,11 +288,11 @@
287288
# pip install -e .[playwright]
288289
# (For the Playwright integration.)
289290
"playwright": [
290-
"playwright>=1.56.0",
291+
"playwright>=1.58.0",
291292
],
292293
# pip install -e .[psutil]
293294
"psutil": [
294-
"psutil>=7.1.3",
295+
"psutil>=7.2.2",
295296
],
296297
# pip install -e .[pyautogui]
297298
# (Already a required dependency on Linux now.)

0 commit comments

Comments
 (0)