cover letter fixed
This commit is contained in:
parent
165a6150f8
commit
6d72788f80
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ generated_cv*
|
|||||||
.vscode
|
.vscode
|
||||||
chrome_profile
|
chrome_profile
|
||||||
answers.json
|
answers.json
|
||||||
|
data*
|
@ -30,7 +30,6 @@ class LinkedInEasyApplier:
|
|||||||
self.resume_generator_manager = resume_generator_manager
|
self.resume_generator_manager = resume_generator_manager
|
||||||
self.all_data = self._load_questions_from_json()
|
self.all_data = self._load_questions_from_json()
|
||||||
|
|
||||||
|
|
||||||
def _load_questions_from_json(self) -> List[dict]:
|
def _load_questions_from_json(self) -> List[dict]:
|
||||||
output_file = 'answers.json'
|
output_file = 'answers.json'
|
||||||
try:
|
try:
|
||||||
@ -49,7 +48,6 @@ class LinkedInEasyApplier:
|
|||||||
tb_str = traceback.format_exc()
|
tb_str = traceback.format_exc()
|
||||||
raise Exception(f"Error loading questions data from JSON file: \nTraceback:\n{tb_str}")
|
raise Exception(f"Error loading questions data from JSON file: \nTraceback:\n{tb_str}")
|
||||||
|
|
||||||
|
|
||||||
def job_apply(self, job: Any):
|
def job_apply(self, job: Any):
|
||||||
self.driver.get(job.link)
|
self.driver.get(job.link)
|
||||||
time.sleep(random.uniform(3, 5))
|
time.sleep(random.uniform(3, 5))
|
||||||
@ -91,7 +89,6 @@ class LinkedInEasyApplier:
|
|||||||
attempt += 1
|
attempt += 1
|
||||||
raise Exception("No clickable 'Easy Apply' button found")
|
raise Exception("No clickable 'Easy Apply' button found")
|
||||||
|
|
||||||
|
|
||||||
def _get_job_description(self) -> str:
|
def _get_job_description(self) -> str:
|
||||||
try:
|
try:
|
||||||
see_more_button = self.driver.find_element(By.XPATH, '//button[@aria-label="Click to see more description"]')
|
see_more_button = self.driver.find_element(By.XPATH, '//button[@aria-label="Click to see more description"]')
|
||||||
@ -107,7 +104,6 @@ class LinkedInEasyApplier:
|
|||||||
tb_str = traceback.format_exc()
|
tb_str = traceback.format_exc()
|
||||||
raise Exception(f"Error getting Job description: \nTraceback:\n{tb_str}")
|
raise Exception(f"Error getting Job description: \nTraceback:\n{tb_str}")
|
||||||
|
|
||||||
|
|
||||||
def _get_job_recruiter(self):
|
def _get_job_recruiter(self):
|
||||||
try:
|
try:
|
||||||
hiring_team_section = WebDriverWait(self.driver, 10).until(
|
hiring_team_section = WebDriverWait(self.driver, 10).until(
|
||||||
@ -253,16 +249,12 @@ class LinkedInEasyApplier:
|
|||||||
if radios:
|
if radios:
|
||||||
question_text = section.text.lower()
|
question_text = section.text.lower()
|
||||||
options = [radio.text.lower() for radio in radios]
|
options = [radio.text.lower() for radio in radios]
|
||||||
|
|
||||||
existing_answer = None
|
existing_answer = None
|
||||||
for item in self.all_data:
|
for item in self.all_data:
|
||||||
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'radio':
|
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'radio':
|
||||||
existing_answer = item
|
existing_answer = item
|
||||||
break
|
self._select_radio(radios, existing_answer['answer'])
|
||||||
if existing_answer:
|
return True
|
||||||
self._select_radio(radios, existing_answer['answer'])
|
|
||||||
return True
|
|
||||||
|
|
||||||
answer = self.gpt_answerer.answer_question_from_options(question_text, options)
|
answer = self.gpt_answerer.answer_question_from_options(question_text, options)
|
||||||
self._save_questions_to_json({'type': 'radio', 'question': question_text, 'answer': answer})
|
self._save_questions_to_json({'type': 'radio', 'question': question_text, 'answer': answer})
|
||||||
self._select_radio(radios, answer)
|
self._select_radio(radios, answer)
|
||||||
@ -283,12 +275,10 @@ class LinkedInEasyApplier:
|
|||||||
answer = self.gpt_answerer.answer_question_textual_wide_range(question_text)
|
answer = self.gpt_answerer.answer_question_textual_wide_range(question_text)
|
||||||
existing_answer = None
|
existing_answer = None
|
||||||
for item in self.all_data:
|
for item in self.all_data:
|
||||||
if item['question'] == self._sanitize_text(question_text) and item['type'] == question_type:
|
if 'cover' not in item['question'] and item['question'] == self._sanitize_text(question_text) and item['type'] == question_type:
|
||||||
existing_answer = item
|
existing_answer = item
|
||||||
break
|
self._enter_text(text_field, existing_answer['answer'])
|
||||||
if existing_answer:
|
return True
|
||||||
self._enter_text(text_field, existing_answer['answer'])
|
|
||||||
return True
|
|
||||||
self._save_questions_to_json({'type': question_type, 'question': question_text, 'answer': answer})
|
self._save_questions_to_json({'type': question_type, 'question': question_text, 'answer': answer})
|
||||||
self._enter_text(text_field, answer)
|
self._enter_text(text_field, answer)
|
||||||
return True
|
return True
|
||||||
@ -302,15 +292,12 @@ class LinkedInEasyApplier:
|
|||||||
answer_date = self.gpt_answerer.answer_question_date()
|
answer_date = self.gpt_answerer.answer_question_date()
|
||||||
answer_text = answer_date.strftime("%Y-%m-%d")
|
answer_text = answer_date.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
|
||||||
existing_answer = None
|
existing_answer = None
|
||||||
for item in self.all_data:
|
for item in self.all_data:
|
||||||
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'date':
|
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'date':
|
||||||
existing_answer = item
|
existing_answer = item
|
||||||
break
|
self._enter_text(date_field, existing_answer['answer'])
|
||||||
if existing_answer:
|
return True
|
||||||
self._enter_text(date_field, existing_answer['answer'])
|
|
||||||
return True
|
|
||||||
|
|
||||||
self._save_questions_to_json({'type': 'date', 'question': question_text, 'answer': answer_text})
|
self._save_questions_to_json({'type': 'date', 'question': question_text, 'answer': answer_text})
|
||||||
self._enter_text(date_field, answer_text)
|
self._enter_text(date_field, answer_text)
|
||||||
@ -325,16 +312,12 @@ class LinkedInEasyApplier:
|
|||||||
if dropdown:
|
if dropdown:
|
||||||
select = Select(dropdown)
|
select = Select(dropdown)
|
||||||
options = [option.text for option in select.options]
|
options = [option.text for option in select.options]
|
||||||
|
|
||||||
existing_answer = None
|
existing_answer = None
|
||||||
for item in self.all_data:
|
for item in self.all_data:
|
||||||
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'dropdown':
|
if self._sanitize_text(question_text) in item['question'] and item['type'] == 'dropdown':
|
||||||
existing_answer = item
|
existing_answer = item
|
||||||
break
|
self._select_dropdown_option(dropdown, existing_answer['answer'])
|
||||||
if existing_answer:
|
return True
|
||||||
self._select_dropdown_option(dropdown, existing_answer['answer'])
|
|
||||||
return True
|
|
||||||
|
|
||||||
answer = self.gpt_answerer.answer_question_from_options(question_text, options)
|
answer = self.gpt_answerer.answer_question_from_options(question_text, options)
|
||||||
self._save_questions_to_json({'type': 'dropdown', 'question': question_text, 'answer': answer})
|
self._save_questions_to_json({'type': 'dropdown', 'question': question_text, 'answer': answer})
|
||||||
self._select_dropdown_option(dropdown, answer)
|
self._select_dropdown_option(dropdown, answer)
|
||||||
@ -385,7 +368,6 @@ class LinkedInEasyApplier:
|
|||||||
tb_str = traceback.format_exc()
|
tb_str = traceback.format_exc()
|
||||||
raise Exception(f"Error saving questions data to JSON file: \nTraceback:\n{tb_str}")
|
raise Exception(f"Error saving questions data to JSON file: \nTraceback:\n{tb_str}")
|
||||||
|
|
||||||
|
|
||||||
def _sanitize_text(self, text: str) -> str:
|
def _sanitize_text(self, text: str) -> str:
|
||||||
sanitized_text = text.lower()
|
sanitized_text = text.lower()
|
||||||
sanitized_text = sanitized_text.strip()
|
sanitized_text = sanitized_text.strip()
|
||||||
|
@ -53,18 +53,6 @@ class LinkedInJobManager:
|
|||||||
def set_resume_generator_manager(self, resume_generator_manager):
|
def set_resume_generator_manager(self, resume_generator_manager):
|
||||||
self.resume_generator_manager = resume_generator_manager
|
self.resume_generator_manager = resume_generator_manager
|
||||||
|
|
||||||
""" def old_question(self):
|
|
||||||
self.set_old_answers = {}
|
|
||||||
file_path = 'data_folder/output/old_Questions.csv'
|
|
||||||
if os.path.exists(file_path):
|
|
||||||
with open(file_path, 'r', newline='', encoding='utf-8', errors='ignore') as file:
|
|
||||||
csv_reader = csv.reader(file, delimiter=',', quotechar='"')
|
|
||||||
for row in csv_reader:
|
|
||||||
if len(row) == 3:
|
|
||||||
answer_type, question_text, answer = row
|
|
||||||
self.set_old_answers[(answer_type.lower(), question_text.lower())] = answer"""
|
|
||||||
|
|
||||||
|
|
||||||
def start_applying(self):
|
def start_applying(self):
|
||||||
self.easy_applier_component = LinkedInEasyApplier(self.driver, self.resume_path, self.set_old_answers, self.gpt_answerer, self.resume_generator_manager)
|
self.easy_applier_component = LinkedInEasyApplier(self.driver, self.resume_path, self.set_old_answers, self.gpt_answerer, self.resume_generator_manager)
|
||||||
searches = list(product(self.positions, self.locations))
|
searches = list(product(self.positions, self.locations))
|
||||||
|
Loading…
Reference in New Issue
Block a user