joeyism / linkedin_scraper

A library that scrapes Linkedin for user data
GNU General Public License v3.0
2.09k stars 575 forks source link

Cannot use get_employees list index out of range #52

Closed yowbst closed 4 years ago

yowbst commented 4 years ago

Getting the below error when running this line: company = Company(linkedin_url='https://www.linkedin.com/company/addmin/', driver=driver, scrape=True)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-25-898c77594b17> in <module>
      3 password = credentials['password']
      4 actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
----> 5 company = Company(linkedin_url='https://www.linkedin.com/company/addmin/', driver=driver, scrape=True, close_on_complete=True)

~/opt/anaconda3/lib/python3.7/site-packages/linkedin_scraper/company.py in __init__(self, linkedin_url, name, about_us, website, headquarters, founded, company_type, company_size, specialties, showcase_pages, affiliated_companies, driver, scrape, get_employees, close_on_complete)
     67 
     68         if scrape:
---> 69             self.scrape(get_employees=get_employees, close_on_complete=close_on_complete)
     70 
     71     def __get_text_under_subtitle(self, elem):

~/opt/anaconda3/lib/python3.7/site-packages/linkedin_scraper/company.py in scrape(self, get_employees, close_on_complete)
     77     def scrape(self, get_employees = True, close_on_complete = True):
     78         if self.is_signed_in():
---> 79             self.scrape_logged_in(get_employees = get_employees, close_on_complete = close_on_complete)
     80         else:
     81             self.scrape_not_logged_in(get_employees = get_employees, close_on_complete = close_on_complete)

~/opt/anaconda3/lib/python3.7/site-packages/linkedin_scraper/company.py in scrape_logged_in(self, get_employees, close_on_complete)
    146 
    147         self.name = driver.find_element_by_xpath('//span[@dir="ltr"]').text.strip()
--> 148         navigation.find_elements_by_xpath("//a[@data-control-name='page_member_main_nav_about_tab']")[0].click()
    149 
    150         _ = WebDriverWait(driver, 3).until(EC.presence_of_all_elements_located((By.TAG_NAME, 'section')))

IndexError: list index out of range
mohitag09 commented 4 years ago

I am facing similar issue. Any resolution?

joeyism commented 4 years ago

I just pushed a fix. Try version 2.5.2