Skip to content

Commit 9009e50

Browse files
authored
Merge pull request #4435 from seleniumbase/cdp-mode-patch-122
CDP Mode: Patch 122
2 parents 2d5d3fa + 8bca2b0 commit 9009e50

16 files changed

Lines changed: 51 additions & 47 deletions

examples/cdp_mode/playwright/raw_footlocker_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
page.wait_for_selector(input_field)
1313
sb.sleep(1.5)
1414
sb.click_if_visible('button[id*="Agree"]')
15-
sb.sleep(1.2)
15+
sb.sleep(0.6)
1616
page.click(input_field)
17-
sb.sleep(0.5)
17+
sb.sleep(0.6)
1818
search = "Nike Shoes"
1919
page.type(input_field, search)
2020
sb.sleep(1.2)

examples/cdp_mode/raw_cdp_clearcote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
sb = sb_cdp.Chrome()
44
sb.goto("https://www.clearcotelabs.com/audit")
55
sb.click('button:contains("Run the audit")')
6-
sb.sleep(5)
7-
sb.assert_element("div.text-emerald-700", timeout=6)
6+
sb.sleep(6)
7+
sb.assert_element("div.text-emerald-700", timeout=8)
88
try:
99
sb.assert_text("100", "div.text-emerald-700", timeout=5)
1010
sb.highlight('div.text-emerald-700:contains("100")')

examples/cdp_mode/raw_cdp_target.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@
1414
print('*** Target Search for "%s":' % search)
1515
print(' (Results must contain "%s".)' % required_text)
1616
unique_item_text = []
17-
items = sb.find_elements('[data-test="product-details"]')
17+
items = sb.find_elements(
18+
'[data-test*="ProductListing"], [data-test="product-details"]'
19+
)
1820
for item in items:
1921
if required_text.lower() in item.text.lower():
20-
description = item.query_selector('a[data-test*="Card/title"]')
22+
description = item.query_selector('h3, a[data-test*="Card/title"]')
2123
if description and description.text not in unique_item_text:
2224
unique_item_text.append(description.text)
2325
print("* " + description.text)
24-
price = item.query_selector('[data-test="current-price"]')
26+
price = item.query_selector(
27+
'[style*="weight: 700;"], [data-test="current-price"]'
28+
)
2529
if price:
2630
print(" (" + price.text + ")")
2731
item.scroll_into_view()

examples/cdp_mode/raw_footlocker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
sb.goto("https://www.footlocker.com/")
66
sb.sleep(2.5)
77
sb.click_if_visible('button[id*="Agree"]')
8-
sb.sleep(1.5)
8+
sb.sleep(0.6)
99
sb.click('input[name="query"]')
10-
sb.sleep(1.5)
10+
sb.sleep(0.6)
1111
search = "Nike Shoes"
1212
sb.press_keys('input[name="query"]', search)
1313
sb.sleep(2.5)

examples/cdp_mode/raw_priceline.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@
3535
sb.switch_to_newest_tab()
3636
sb.sleep(0.6)
3737
sb.sleep(0.8)
38-
for y in range(1, 9):
39-
sb.scroll_to_y(y * 200)
40-
sb.sleep(0.4)
41-
hotels = sb.find_elements('div[data-vis-key*="content"]')
38+
titles = []
4239
count = 0
43-
for hotel in hotels:
44-
title = hotel.query_selector("h3")
45-
if title:
46-
price = hotel.query_selector(".text-heading4")
47-
if price:
48-
count += 1
49-
price_text = price.text.replace(" ", "")
50-
print("* %s: %s => %s" % (count, title.text, price_text))
40+
for y in range(1, 10):
41+
sb.scroll_to_y(y * 500)
42+
hotels = sb.find_elements('div[data-vis-key*="content"]')
43+
for hotel in hotels:
44+
title = hotel.query_selector("h3")
45+
if title and title not in titles:
46+
titles.append(title)
47+
price = hotel.query_selector(".text-heading4")
48+
if price:
49+
count += 1
50+
price_text = price.text.replace(" ", "")
51+
print("* %s: %s => %s" % (count, title.text, price_text))
5152
if not count:
5253
print("No availability over the selected dates!")

examples/cdp_mode/raw_science.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
sb.activate_cdp_mode()
55
sb.goto("https://earth.esa.int/eogateway/search")
66
sb.sleep(1)
7-
sb.click_if_visible('button:contains("Accept cookies")')
7+
sb.click_if_visible('button:contains("Accept cookies")', timeout=3)
88
for i in range(20):
99
sb.scroll_to_bottom()
1010
sb.click_if_visible('button:contains("READ MORE")')

examples/cdp_mode/raw_target.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@
1515
print('*** Target Search for "%s":' % search)
1616
print(' (Results must contain "%s".)' % required_text)
1717
unique_item_text = []
18-
items = sb.find_elements('[data-test="product-details"]')
18+
items = sb.find_elements(
19+
'[data-test*="ProductListing"], [data-test="product-details"]'
20+
)
1921
for item in items:
2022
if required_text.lower() in item.text.lower():
21-
description = item.query_selector('a[data-test*="Card/title"]')
23+
description = item.query_selector('h3, a[data-test*="Card/title"]')
2224
if description and description.text not in unique_item_text:
2325
unique_item_text.append(description.text)
2426
print("* " + description.text)
25-
price = item.query_selector('[data-test="current-price"]')
27+
price = item.query_selector(
28+
'[style*="weight: 700;"], [data-test="current-price"]'
29+
)
2630
if price:
2731
print(" (" + price.text + ")")
2832
item.scroll_into_view()

examples/raw_invisible_captcha.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from seleniumbase import SB
22

3-
with SB(uc=True, test=True, guest=True) as sb:
3+
with SB(uc=True, test=True) as sb:
44
sb.activate_cdp_mode()
55
sb.goto("https://seleniumbase.io/apps/invisible_recaptcha")
66
sb.sleep(1)

mkdocs_build/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# mkdocs dependencies for generating the seleniumbase.io website
22
# Minimum Python version: 3.10 (for generating docs only)
33

4-
regex>=2026.7.10
4+
regex>=2026.7.19
55
pymdown-extensions>=10.21.3
6-
pipdeptree>=3.1.1
6+
pipdeptree>=4.0.0
77
python-dateutil>=2.8.2
88
click>=8.4.2
99
Markdown==3.10.2

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exceptiongroup>=1.3.1
1010
websockets~=15.0.1;python_version<"3.10"
1111
websockets>=16.1.1;python_version>="3.10"
1212
filelock~=3.19.1;python_version<"3.10"
13-
filelock>=3.31.0;python_version>="3.10"
13+
filelock>=3.31.1;python_version>="3.10"
1414
fasteners>=0.20
1515
mycdp>=1.4.0
1616
pynose>=1.5.5
@@ -66,7 +66,8 @@ pytest-rerunfailures==16.4;python_version>="3.11"
6666
pytest-xdist==3.8.0
6767
parameterized==0.9.0
6868
behave==1.2.6
69-
soupsieve~=2.8.4
69+
soupsieve~=2.8.4;python_version<"3.10"
70+
soupsieve~=2.9.0;python_version>="3.10"
7071
beautifulsoup4~=4.15.0
7172
pyotp~=2.10.0
7273
python-xlib==0.33;platform_system=="Linux"

0 commit comments

Comments
 (0)