Skip to content

Commit cf08b2b

Browse files
committed
Update a CDP Mode example
1 parent 44c5164 commit cf08b2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/cdp_mode/raw_walmart.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
required_text = "Catan"
1111
sb.cdp.press_keys('input[aria-label="Search"]', search + "\n")
1212
sb.sleep(3.8)
13-
items = sb.cdp.find_elements('div[data-testid="list-view"]')
1413
print('*** Walmart Search for "%s":' % search)
1514
print(' (Results must contain "%s".)' % required_text)
15+
unique_item_text = []
16+
items = sb.cdp.find_elements('div[data-testid="list-view"]')
1617
for item in items:
1718
if required_text in item.text:
1819
description = item.querySelector(
1920
'[data-automation-id="product-price"] + span'
2021
)
21-
if description:
22+
if description and description.text not in unique_item_text:
23+
unique_item_text.append(description.text)
2224
print("* " + description.text)
2325
price = item.querySelector(
2426
'[data-automation-id="product-price"]'

0 commit comments

Comments
 (0)