Skip to content

Commit

Permalink
Update a CDP Mode example
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Nov 4, 2024
1 parent 44c5164 commit cf08b2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/cdp_mode/raw_walmart.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
required_text = "Catan"
sb.cdp.press_keys('input[aria-label="Search"]', search + "\n")
sb.sleep(3.8)
items = sb.cdp.find_elements('div[data-testid="list-view"]')
print('*** Walmart Search for "%s":' % search)
print(' (Results must contain "%s".)' % required_text)
unique_item_text = []
items = sb.cdp.find_elements('div[data-testid="list-view"]')
for item in items:
if required_text in item.text:
description = item.querySelector(
'[data-automation-id="product-price"] + span'
)
if description:
if description and description.text not in unique_item_text:
unique_item_text.append(description.text)
print("* " + description.text)
price = item.querySelector(
'[data-automation-id="product-price"]'
Expand Down

0 comments on commit cf08b2b

Please sign in to comment.