Skip to content

Commit

Permalink
Feature: uploads dict working
Browse files Browse the repository at this point in the history
krapes committed Jul 17, 2020
1 parent d93501f commit 288d9a6
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions easyapplybot.py
Original file line number Diff line number Diff line change
@@ -25,20 +25,21 @@ class EasyApplyBot:

MAX_SEARCH_TIME = 10*60

photo = '/home/kerri/Pictures/surfing.jpg'
#photo = '/home/kerri/Pictures/surfing.jpg'

def __init__(self,
username,
password,
cover_letter_loctn=None,
uploads={},
filename='output.csv',
blacklist=[]):

print("\nWelcome to Easy Apply Bot\n")
dirpath = os.getcwd()
print("current directory is : " + dirpath)

self.cover_letter_loctn = cover_letter_loctn
#self.cover_letter_loctn = cover_letter_loctn
self.uploads = uploads
self.appliedJobIDs = self.get_appliedIDs(filename) if self.get_appliedIDs(filename) != None else []
self.filename = filename
self.options = self.browser_options()
@@ -96,7 +97,6 @@ def fill_data(self):
self.browser.set_window_size(0, 0)
self.browser.set_window_position(2000, 2000)

print(self.cover_letter_loctn)

def start_apply(self, positions, locations):
start = time.time()
@@ -164,7 +164,6 @@ def applications_loop(self, position, location):
jobIDs = [x for x in IDs if x not in self.appliedJobIDs]
after = len(jobIDs)

jobIDs = [1943232413]
if len(jobIDs) == 0 and len(IDs) > 24:
jobs_per_page = jobs_per_page + 25
count_job = 0
@@ -290,14 +289,11 @@ def is_present(button_locator):
for input_button in input_buttons:
parent = input_button.find_element(By.XPATH, "..")
sibling = parent.find_element(By.XPATH, "preceding-sibling::*")
print(sibling)
print(sibling.text)
if 'Photo' in sibling.text:
input_button.send_keys(self.photo)

grandparent = sibling.find_element(By.XPATH, "..")
print(grandparent)
print(grandparent.text)
for key in self.uploads.keys():
if key in sibling.text or key in grandparent.text:
input_button.send_keys(self.uploads[key])


#input_button[0].send_keys(self.cover_letter_loctn)
time.sleep(random.uniform(4.5, 6.5))
@@ -381,6 +377,9 @@ def next_jobs_page(self, position, location, jobs_per_page):
def finish_apply(self):
self.browser.close()




if __name__ == '__main__':

with open("config.yaml", 'r') as stream:
@@ -396,14 +395,17 @@ def finish_apply(self):


print(parameters)
cover_letter_loctn = parameters.get('cover_letter_loctn', [None])[0]
#cover_letter_loctn = parameters.get('cover_letter_loctn', [None])[0]
output_filename = [f for f in parameters.get('output_filename', ['output.csv']) if f != None]
output_filename = output_filename[0] if len(output_filename) > 0 else 'output.csv'
blacklist = parameters.get('blacklist', [])
uploads = parameters.get('uploads', {})
for key in uploads.keys():
assert uploads[key] != None

bot = EasyApplyBot(parameters['username'],
parameters['password'],
cover_letter_loctn=cover_letter_loctn,
uploads=uploads,
filename=output_filename,
blacklist=blacklist
)

0 comments on commit 288d9a6

Please sign in to comment.