Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to apply to jobs, seeminly caused by inability to find the correct elements #42

Open
theusernamewhichismine opened this issue Jul 27, 2022 · 12 comments

Comments

@theusernamewhichismine
Copy link

Line 123 in linkedineasyapply.py
try:
job_results = self.browser.find_element_by_class_name("jobs-search-results")
self.scroll_slow(job_results)
self.scroll_slow(job_results, step=300, reverse=True)

This bit was what made it scroll through the jobs list up and down. the find_element_by_class_name appears to be the problem as that element is now called "jobs-search-results-list". If I change the line to read

        job_results = self.browser.find_element_by_class_name("jobs-search-results-list")

Then it will successfully scroll through the list up and down.

After that however I'm stuck and can't fix it. At line 128

        job_list = self.browser.find_elements_by_class_name('jobs-search-results__list')[0].find_elements_by_class_name('jobs-search-results__list-item')

This bit was what made it actually find the jobs themselves. Again the elements seem to be misnamed now, possibly due to a LinkedIn update, but I can't seem to make it find the jobs. It instead goes straight to raising the exception "No more jobs on this page".

I'm just not that good at inspecting elements so I don't know how to fix it. There is a div class "job-search-results-list" within which is a ul class "scaffold-layout__list-container" within which are the "li id" items for each job, with the following

class="ember-view jobs-search-results__list-item occludable-update p0 relative scaffold-layout__list-item

        "

So I'm not sure how to update that line to make it find each of these proper elements. But I know exactly where it is failing.

@theusernamewhichismine
Copy link
Author

theusernamewhichismine commented Jul 27, 2022

Actually I seem to have fixed it with the following edit. Lines 123 through 128 currently read

    try:
        job_results = self.browser.find_element_by_class_name("jobs-search-results")
        self.scroll_slow(job_results)
        self.scroll_slow(job_results, step=300, reverse=True)

        job_list = self.browser.find_elements_by_class_name('jobs-search-results__list')[0].find_elements_by_class_name('jobs-search-results__list-item')

I changed them to read

    try:
        job_results = self.browser.find_element_by_class_name("jobs-search-results-list")
        self.scroll_slow(job_results)
        self.scroll_slow(job_results, step=300, reverse=True)

        job_list = self.browser.find_elements_by_class_name('scaffold-layout__list-container')[0].find_elements_by_class_name('jobs-search-results__list-item')

And it started working. Now I don't really know how github version controlling works, I do version control by naming things finalFINAL2 etc, but editing linkedineasyapply.py in this way fixes the issue

@logix727
Copy link

This worked for you? it is not for me what else did u change?

@theusernamewhichismine
Copy link
Author

That change on lines 123 through 128 was the only change I made, sorry it isn't working for you. Did you replace the lines completely?

@osama3101995
Copy link

osama3101995 commented Aug 2, 2022

Can confirm this is the fix. However, it seems to be causing issues on last 1-2 jobs and throws error log, and continue onwards

Can you please tell us how we can contribute to this project? as I also tried to update the code and couldn't do it.

@theusernamewhichismine
Copy link
Author

Update update, although that fix worked previously, the LinkedIn UI seems to have reverted to what it used to be. My fix no longer works and the original easyapply.py code is now working. I don't know if LinkedIn is deliberately switching up the UI to shake out botting like this, or if it's just normal UI updates and tests. Regardless, I wanted to write down for posterity how you, the read can try to fix this in the future if the UI changes again, since it seems this repo isn't being actively updated.

If the bot manages to open Chrome and sign in to LinkedIn, but then fails to scroll through the job list or make any application, then it's probably not finding the correct UI elements (this can be confirmed by looking at the error messages in the command line log). If you log in to LinkedIn on Chrome, you can go to the jobs page and hit F12 to open up the element inspector. On the top right of your screen you will now have a pane that says "elements" at the top and will let you see what every element of the webpage is called. Hovering over any line in that elements pane will highlight what element it is referencing. For instance, hovering over.

Each element that begins with "<div class =" is where you want to start looking. So currently the results list is

And hover over that will give you a list of all the jobs.

Now you can use those UI elements to change what element names easyapply.py is looking for, in case LinkedIn ever updates their site UI again.

@osama3101995
Copy link

Can we create a new repository of this and push our updates there? Since I am also sometimes updating this project with new features (I am not a python dev btw)? Can we somehow get approval of the main dev??

Repository owner deleted a comment from zdondada Aug 9, 2022
@zszszz
Copy link

zszszz commented Sep 13, 2022

Curious as to any more fixes for this. Experiencing same issue and tried both versions of code (modified and original) mentioned in this issue

@logix727
Copy link

logix727 commented Sep 13, 2022 via email

@zszszz
Copy link

zszszz commented Sep 13, 2022

Code below currently

        try:
            job_results = self.browser.find_element(By.CLASS_NAME, "jobs-search-results-list")
            self.scroll_slow(job_results)
            self.scroll_slow(job_results, step=300, reverse=True)

            job_list = job_results.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0].find_elements_by_class_name('jobs-search-results__list-item')
        except:
            raise Exception("No more jobs on this page")

        if len(job_list) == 0:
            raise Exception("No more jobs on this page")

        for job_tile in job_list:
            job_title, company, job_location, apply_method, link = "", "", "", "", ""

            try:

                job_list = job_results.find_elements_by_class_name('scaffold-layout__list-container')[0].find_elements_by_class_name('scaffold-layout__list-item')
                job_title = job_tile.find_element_by_class_name('job-card-list__title').text
                link = job_tile.find_element_by_class_name('job-card-list__title').get_attribute('href').split('?')[0]

@zszszz
Copy link

zszszz commented Sep 15, 2022

The above code is working now suddenly

@xMacJ
Copy link

xMacJ commented Oct 10, 2022

Hmm the above code change seems to scroll to the job list and do nothing
image

@xMacJ
Copy link

xMacJ commented Oct 10, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants