feder-cr / Auto_Jobs_Applier_AIHawk

Auto_Jobs_Applier_AIHawk is a tool that automates the jobs application process. Utilizing artificial intelligence, it enables users to apply for multiple job offers in an automated and personalized way.
Other
17.5k stars 2.54k forks source link

Hawk does not apply for jobs. linkedIn_job_manager does not work properly #114

Open pafthinder opened 1 month ago

pafthinder commented 1 month ago

both content and linkedIn language are english I tried to change to dark mode, but it's not possible, huh. even though I changed it when browser is opened by script light mode somehow returns

Screenshot_2.png - scrolls to the bottom Screenshot_3.png - exactly the same behavior (scrolling to the bottom) even if there are no jobs meeting criteria Screenshot_4.png - scrolls to the top, continuing to the next "page" (even though in the current one there were no offers)

Starting Chrome browser to log in to LinkedIn.
User is already logged in.
Starting the search for IT Project Manager in Barcelona, Catalonia, Spain.
Going to job page 0
Starting the application process for this page...
Applying to jobs on this page has been completed!
Going to job page 1
Starting the application process for this page...
The element is not scrollable.
The element is not scrollable.
Starting the search for Technical Product Manager in Krakow, Malopolskie, Poland.
Going to job page 0
Starting the application process for this page...
Applying to jobs on this page has been completed!
Going to job page 1
Starting the application process for this page...
The element is not scrollable.
The element is not scrollable.
Starting the search for Data Development Product Owner in Barcelona, Catalonia, Spain.
Going to job page 0
Starting the application process for this page...
Applying to jobs on this page has been completed!
Sleeping for 0.08333333333333333 minutes.
Going to job page 1
Starting the application process for this page...
Applying to jobs on this page has been completed!
Going to job page 2
Starting the application process for this page...
Applying to jobs on this page has been completed!
Going to job page 3
Starting the application process for this page...

Screenshot_2 Screenshot_3 Screenshot_4

please help. Ask any further questions for clarification, I will gladly provide more information. Lemme know if I can help somehow.

Regards, Simon

iliasjaddi commented 1 month ago

Me too! It's not applying to any jobs!

pafthinder commented 1 month ago

I think it has something to do with the layout of LinkedIn page ; for some people layout ( therefore class names like this link = job_tile.find_element(By.CLASS_NAME, 'job-card-list__title').get_attribute('href').split('?')[0] ) is compatible and for some is not

but what's the pattern here? I have shown my layout above. it looks pretty... basic I would say.

any idea will be appreciated

pafthinder commented 1 month ago

I have LinkedIn learning subscription, maybe that changes whole layout of LI page and therefore markups are misaligned? @iliasjaddi - do you have LI premium or LI learning subscription?

pafthinder commented 1 month ago

there is problem in apply_jobs method of LinkedInJobManager class (linkedIn_job_manager.py @ 127)

job_list_elements = self.driver.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0].find_elements(By.CLASS_NAME, 'jobs-search-results__list-item occludable-update p0 relative scaffold-layout__list-item') job_list_elements remains empty (I updated CLASS_NAME in my code for testing purpose, no luck with this, nor orignal CLASS_NAME)

but if we look one level higher using job_list_elements_debug = self.driver.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0]

we can see its being filled with data image

so there is some issue with find_elements in 0th element of job_list_elements

I tried to access text from job_list_elements job_list_elements = self.driver.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0].text

but it doesn't pass what's necessary to job_list = [Job(*self.extract_job_information_from_tile(job_element)) for job_element in job_list_elements]

@feder-cr please take a look in a spare moment, thanks.

pafthinder commented 1 month ago
Going to job page 0
Starting the application process for this page...
The element is not scrollable.
The element is not scrollable.
Starting the search for Technical Support in Wroclaw Metropolitan Area.
Going to job page 0
Starting the application process for this page...
The element is not scrollable.
The element is not scrollable.
Starting the search for Technical Support in Vienna, Austria.
Going to job page 0
Starting the application process for this page...
The element is not scrollable.
The element is not scrollable.
Starting the search for Technical Support in Amsterdam Area.
Going to job page 0
Starting the application process for this page...

unpredictable behavior here. no matter if it finds jobs in the left pane or it doesn't, it does one of 2 actions

pafthinder commented 1 month ago

I have managed to send my first automated application using this altered code apply_jobs() and extract_job_information_from_tile() functions are updated @ linkedIn_job_manager.py still it gets pretty buggy

use at ur own responsibility and lemme know if it helps in ur case

   def apply_jobs(self):
        try:
            # Wait for the job list container to be present
            WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located((By.CLASS_NAME, "scaffold-layout__list-container"))
            )

            # Find the job list container
            job_list_container = self.driver.find_element(By.CLASS_NAME, "scaffold-layout__list-container")

            # Find all job items within the container
            job_list_elements = job_list_container.find_elements(By.CSS_SELECTOR, 
                "li.ember-view.jobs-search-results__list-item.occludable-update.p0.relative.scaffold-layout__list-item")

            print(f"Number of job elements found: {len(job_list_elements)}")

            if not job_list_elements:
                raise Exception("No job elements found on page")

            for job_element in job_list_elements:
                job = Job(*self.extract_job_information_from_tile(job_element))
                print(f"Processing job: {job.title} at {job.company}")
                if self.is_blacklisted(job.title, job.company, job.link):
                    utils.printyellow(f"Blacklisted {job.title} at {job.company}, skipping...")
                    self.write_to_file(job, "skipped")
                    continue
                try:
                    if job.apply_method not in {"Continue", "Applied", "Apply"}:
                        self.easy_applier_component.job_apply(job)
                        self.write_to_file(job, "success")
                    else:
                        utils.printyellow(f"Skipping {job.title} due to apply method: {job.apply_method}")
                except Exception as e:
                    utils.printred(f"Error applying to {job.title}: {str(e)}")
                    utils.printred(traceback.format_exc())
                    self.write_to_file(job, "failed")
                    continue
        except Exception as e:
            utils.printred(f"Error in apply_jobs: {str(e)}")
            utils.printred(traceback.format_exc())

# Update the extract_job_information_from_tile method
    def extract_job_information_from_tile(self, job_tile):
        job_title, company, job_location, apply_method, link = "", "", "", "", ""
        try:
            job_title = job_tile.find_element(By.CSS_SELECTOR, 'a.job-card-list__title').text
            link = job_tile.find_element(By.CSS_SELECTOR, 'a.job-card-list__title').get_attribute('href').split('?')[0]
            company = job_tile.find_element(By.CSS_SELECTOR, '.job-card-container__primary-description').text
            job_location = job_tile.find_element(By.CSS_SELECTOR, '.job-card-container__metadata-item').text
            apply_method = job_tile.find_element(By.CSS_SELECTOR, '.job-card-container__apply-method').text
        except NoSuchElementException as e:
            print(f"Error extracting job information: {str(e)}")

        return job_title, company, job_location, link, apply_method
feder-cr commented 1 month ago

@Andres-Ventura this is the same error?

Antharithm commented 1 month ago

Is it possible to reduce the sleeping time? 800 seconds between jobs adds up

pafthinder commented 1 month ago

yes it is, linkedIn_job_manager -> start_applying() -> minimum_time

pafthinder commented 1 month ago

how is that completed?

queukat commented 6 days ago

fixed in https://github.com/feder-cr/Auto_Jobs_Applier_AIHawk/pull/473

jcl0251 commented 2 days ago

fixed in #473

What was fixed? I've been trying to get this fixed. It runs but either fails or skips for the applications.

I've tried running off of your version, but I'm getting other errors now.