-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply.py
125 lines (108 loc) · 4.51 KB
/
apply.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from selenium import webdriver
import time
import pandas as pd
from selenium.common.exceptions import NoSuchElementException
import config
from webdriver_manager.chrome import ChromeDriverManager
#iz main.py#dodaje link za apliciranje
df = pd.read_csv("spisakposlova.csv")
df["konkurs"] = "https://poslovi.infostud.com/konkurs/"
df.columns = ["Pozicija", "link", "konkurs", "aplicirao"]
df['konkurs'] = df['link'].str.extract("(\d\d\d\d\d\d)", expand=True)
df['konkurs'] = 'https://poslovi.infostud.com/konkurs/' + df['konkurs'].astype(str)
df.to_csv("spisakposlova.csv", index=False, header=True)
df = pd.read_csv('spisakposlova.csv')
urls = df['konkurs']
for url in urls:
try:
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('https://poslovi.infostud.com/prijava?redirect=%2F')
driver.maximize_window()
usernamebox = driver.find_element_by_id("Email_login")
usernamebox.send_keys('milan.krcadinac@gmail.com')
passbox = driver.find_element_by_id("Password_login")
passbox.send_keys(config.password)
loginbutton = driver.find_element_by_xpath('//*[@id="Password_login"]')
loginbutton.submit()
time.sleep(2)
#data = {}
driver.get(url)
cookies = driver.find_element_by_xpath('//*[@id="__allow_ct_container"]/div/div/a')
cookies.click()
cv = driver.find_element_by_css_selector("input[type='radio'][value='293608']")
cv.click()
cover = driver.find_element_by_css_selector("input[type='radio'][value='64176']")
cover.click()
time.sleep(0.5)
try:
grad = driver.find_element_by_xpath(
'//*[@id="__prijava-form"]/div[1]/div[4]/div/div/div[2]/div[1]/div[1]/input')
grad.click()
prijava = driver.find_element_by_xpath('//*[@id="__prijava-submit"]')
prijava.click()
time.sleep(5)
konkurisi = driver.find_element_by_xpath('//*[@id="__prijava-preview-submit"]')
konkurisi.click()
time.sleep(0.5)
# df = pd.read_csv("spisakposlova.csv")
# df["aplicirao"] = "aplicirao"
# df.to_csv("spisakposlova.csv", index=False, header=True)
driver.close()
except NoSuchElementException:
prijava = driver.find_element_by_xpath('//*[@id="__prijava-submit"]')
prijava.click()
time.sleep(5)
konkurisi = driver.find_element_by_xpath('//*[@id="__prijava-preview-submit"]')
konkurisi.click()
time.sleep(0.5)
driver.close()
else:
vecaplicirano = driver.find_element_by_xpath('//*[@id="modal-container-layout-forced"]/div/div[3]/button[1]')
vecaplicirano.click()
driver.close()
except NoSuchElementException:
driver.get(url)
driver.close()
else:
vecaplicirano = driver.find_element_by_xpath('//*[@id="modal-container-layout-forced"]/div/div[3]/button[1]')
vecaplicirano.click()
driver.close()
#
# driver = webdriver.Chrome(ChromeDriverManager().install())
# driver.get('https://poslovi.infostud.com/prijava?redirect=%2F')
# driver.maximize_window()
#
# usernamebox = driver.find_element_by_id("Email_login")
# usernamebox.send_keys('milan.krcadinac@gmail.com')
#
# passbox = driver.find_element_by_id("Password_login")
# passbox.send_keys(config.password)
#
# loginbutton = driver.find_element_by_xpath('//*[@id="Password_login"]')
# loginbutton.submit()
# time.sleep(2)
# # data = {}
# driver.get(url)
#
# cookies = driver.find_element_by_xpath('//*[@id="__allow_ct_container"]/div/div/a')
# cookies.click()
#
# cv = driver.find_element_by_css_selector("input[type='radio'][value='293608']")
# cv.click()
#
# cover = driver.find_element_by_css_selector("input[type='radio'][value='64176']")
# cover.click()
# time.sleep(0.5)
#
# prijava = driver.find_element_by_xpath('//*[@id="__prijava-submit"]')
# prijava.click()
#
# time.sleep(5)
# konkurisi = driver.find_element_by_xpath('//*[@id="__prijava-preview-submit"]')
# konkurisi.click()
# time.sleep(0.5)
#
# driver.close()
#value="Nastavak konkurisanja"
#text_found = re.search(r'Napuštate sajt Poslovi.infostud.com', src)
#self.assertNotEqual(text_found, None)