Skip to content

Commit 0694314

Browse files
committed
Update an example
1 parent a06d90d commit 0694314

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

examples/cdp_mode/raw_indeed.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@
33
with SB(uc=True, test=True) as sb:
44
url = "https://www.indeed.com/companies/search"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(2.2)
7-
sb.uc_gui_click_captcha()
8-
sb.sleep(1)
9-
company = "NASA Jet Propulsion Laboratory"
106
search_box = 'input[data-testid="company-search-box"]'
7+
if not sb.is_element_present(search_box):
8+
sb.sleep(2)
9+
sb.uc_gui_click_captcha()
10+
sb.sleep(1)
11+
company = "NASA Jet Propulsion Laboratory"
1112
sb.click(search_box)
1213
sb.sleep(0.1)
1314
sb.press_keys(search_box, company)
1415
sb.click('button[type="submit"]')
1516
sb.click('a:contains("%s")' % company)
16-
sb.sleep(3)
17-
sb.uc_gui_click_captcha()
17+
name_header = 'div[itemprop="name"]'
1818
sb.sleep(1)
19-
sb.cdp.highlight('div[itemprop="name"]')
19+
if not sb.is_element_present(name_header):
20+
sb.sleep(2)
21+
sb.uc_gui_click_captcha()
22+
sb.sleep(1)
23+
sb.cdp.highlight(name_header)
2024
sb.sleep(1)
2125
sb.cdp.highlight('h2:contains("About the company")')
22-
sb.sleep(2)
26+
sb.sleep(1)
2327
for i in range(10):
2428
sb.cdp.scroll_down(12)
2529
sb.sleep(0.14)

0 commit comments

Comments
 (0)