-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathraw_indeed.py
More file actions
49 lines (48 loc) · 1.54 KB
/
Copy pathraw_indeed.py
File metadata and controls
49 lines (48 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from seleniumbase import SB
with SB(uc=True, test=True, guest=True) as sb:
sb.activate_cdp_mode()
sb.goto("https://www.indeed.com/companies/search")
sb.sleep(3)
sb.solve_captcha()
sb.sleep(2)
search_box = "input#company-search"
if not sb.is_element_present(search_box):
sb.solve_captcha()
sb.sleep(3)
if not sb.is_element_present(search_box):
sb.uc_gui_click_captcha()
sb.sleep(3)
if not sb.is_element_present(search_box):
sb.uc_gui_handle_captcha()
sb.sleep(3)
company = "NASA Jet Propulsion Laboratory"
try:
sb.click(search_box)
except Exception:
sb.save_screenshot_to_logs()
sb.save_page_source_to_logs()
sb.save_as_pdf_to_logs()
raise
sb.sleep(0.1)
sb.press_keys(search_box, company)
sb.click('button[type="submit"]')
sb.click('a:contains("%s")' % company)
name_header = 'div[itemprop="name"]'
sb.sleep(1)
if not sb.is_element_present(name_header):
sb.sleep(2)
sb.solve_captcha()
sb.sleep(1)
sb.highlight(name_header)
sb.sleep(1)
sb.cdp.highlight('h2:contains("About the company")')
sb.sleep(1)
for i in range(10):
sb.scroll_down(12)
sb.sleep(0.14)
info = sb.find_element('[data-testid="AboutSection-section"]')
soup = sb.get_beautiful_soup(info.get_html()).get_text("\n").strip()
print("*** %s: ***\n%s" % (company, soup.replace("\n:", ":")))
sb.save_screenshot_to_logs()
sb.save_page_source_to_logs()
sb.save_as_pdf_to_logs()