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

Fixed handling for when a person has multiple positions under a company #151

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

myrontuttle
Copy link

I was getting an error that the work_time variable wasn't set when trying to scrape my own experiences: https://www.linkedin.com/in/myrongt/details/experience/
This was because I have had multiple positions with the same company.
This change fixes that issue.

@joeyism
Copy link
Owner

joeyism commented May 10, 2023

Hi, can you please resolve the merge conficts, then I'll merge this in? Thanks

@iadnanmalik
Copy link

Please merge this asap, I'm getting the same issue.

@myrontuttle
Copy link
Author

Yep, conflicts resolved.

@shanedoolane
Copy link

this pr doesn't work anymore

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"span"} (Session info: chrome=114.0.5735.133); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception

venv/lib/python3.11/site-packages/linkedin_scraper/person.py", line 131, in get_experiences position_title = outer_positions[0].find_element(By.TAG_NAME,"span").find_element(By.TAG_NAME,"span").text ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if position_summary_text and len(
position_summary_text.find_element_by_class_name("pvs-list").find_element_by_class_name("pvs-list").find_elements_by_xpath("li")) > 1:
descriptions = position_summary_text.find_element_by_class_name("pvs-list").find_element_by_class_name("pvs-list").find_elements_by_xpath("li")
if position_summary_text and len(position_summary_text.find_element(By.CLASS_NAME,"pvs-list").find_element(By.CLASS_NAME,"pvs-list").find_elements(By.XPATH,"li")) > 1:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This element is missing in some profiles i check

@joeyism
Copy link
Owner

joeyism commented Jun 25, 2023

this pr doesn't work anymore

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"span"} (Session info: chrome=114.0.5735.133); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception

venv/lib/python3.11/site-packages/linkedin_scraper/person.py", line 131, in get_experiences position_title = outer_positions[0].find_element(By.TAG_NAME,"span").find_element(By.TAG_NAME,"span").text ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@shanedoolane if you fork this, fix it, and submit a PR, I'll merge it in and deploy

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

Successfully merging this pull request may close these issues.

None yet

4 participants