Skip to content

Commit f105647

Browse files
committed
Update CDP Mode examples
1 parent 5915850 commit f105647

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
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)

0 commit comments

Comments
 (0)