-
Notifications
You must be signed in to change notification settings - Fork 0
/
joblist.py
93 lines (53 loc) · 2.33 KB
/
joblist.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from selenium import webdriver
import time
import pandas as pd
import os
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
url1="https://www.linkedin.com/jobs/search?keywords=Marketing%20Data%20Analyst&location=Berlin%2C%20Berlin%2C%20Germany&geoId=106967730&trk=public_jobs_jobs-search-bar_search-submit&position=1&pageNum=0"
y=driver.find_elements_by_class_name('results-context-header__job-count')[0].text
from selenium.webdriver.firefox.options import Options
options = Options()
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
driver = webdriver.Firefox(executable_path=r'C:\Users\rafae\OneDrive\Documentos\.wdm\drivers\geckodriver\win64\v0.32.0\geckodriver.exe', options=options)
driver.set_window_size(1024, 600)
driver.maximize_window()
driver.get(url1)
i = 2
while i <= int((n+200)/25)+1:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
i = i + 1
try:
send=driver.find_element_by_xpath("//button[@aria-label='Load more results']")
driver.execute_script("arguments[0].click();", send)
time.sleep(3)
#buu=driver.find_elements_by_tag_name("button")
#x=[btn for btn in buu if btn.text=="See more jobs"]
#for btn in x:
#driver.execute_script("arguments[0].click();", btn)
#time.sleep(3)
except:
pass
time.sleep(5)
companyname= []
titlename= []
try:
for i in range(n):
company=driver.find_elements_by_class_name('base-search-card__subtitle')[i].text
companyname.append(company)
except IndexError:
print("no")
company
try:
for i in range(n):
title=driver.find_elements_by_class_name('base-search-card__title')[i].text
titlename.append(title)
except IndexError:
print("no")
len(titlename)
companyfinal=pd.DataFrame(companyname,columns=["company"])
titlefinal=pd.DataFrame(titlename,columns=["title"])
n=pd.to_numeric(y)
x=companyfinal.join(titlefinal)