joeyism / linkedin_scraper

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

unable to use it #129

Open Daniel3356 opened 1 year ago

Daniel3356 commented 1 year ago

Hi this is my script:

from linkedin_scraper import Person, actions
from selenium import webdriver

PATH = "................/linkedin_scraper/chromedriver"
driver = webdriver.Chrome(PATH)

email = "somone@protonmail.com"
password = "passworrd123"
actions.login(driver, email, password)
person = Person("https://www.linkedin.com/in/someone/", driver=driver)

I'm on mac M1 when selenium is able to open chrome on my M1 arm Mac(latest version of python and pip). Using this script:

import os
from selenium import webdriver

PATH = "................/linkedin_scraper/chromedriver"
driver = webdriver.Chrome(PATH)

driver.get('https://www.google.com/')

but once The bot try to login with the email and password: actions.login(driver, email, password) this is when I get this error:

me@me-MBP samples % python3 123.py 
................/linkedin_scraper/samples/123.py:5: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(PATH)
Traceback (most recent call last):
  File "................/Downloads/linkedin_scraper/samples/123.py", line 9, in <module>
    actions.login(driver, email, password)
  File "/Users/me/Library/Python/3.10/lib/python/site-packages/linkedin_scraper/actions.py", line 26, in login
    email_elem = driver.find_element_by_id("username")
AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'

requirements.txt is install with pip How can I fix the issue? Thanks

lasagna0 commented 1 year ago

You need to use a older version of seleniun, cause they change the attribute 'find_element_by_id' in their most recent release. I recommend to you use 4.2.0. You can specify it in the requirements.txt as selenium==4.2.0