joeyism / linkedin_scraper

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

invalid session id #25

Closed Jeroenvanbennekom closed 4 years ago

Jeroenvanbennekom commented 5 years ago

I run into an 'invalid session id' error from selenium each time I try to use this scraper. I use the following code:

from linkedin_scraper import Person, actions
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe", )
email = myemailaddress@gmail.com
password = mypassword  
actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
person = Person("https://www.linkedin.com/in/andre-iguodala-65b48ab5", driver=driver, scrape=True)

Person(linkedin_url=None, experiences=[], educations=[], driver=driver, scrape=True)
person.scrape()

Where myemailaddress@gmail.com is subbed for my real email address and password for my real password

When I run the script, Selenium succesfully opens a browser, goes to Linkedin.com, logs in and goes to the page of andre iguodala. Then, I get the following error:

C:\Users\jbennekom\Desktop\linkedin_scraper-master\linkedin_scraper\testje.py:22: DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe", ) Traceback (most recent call last): File "C:\Users\jbennekom\Desktop\linkedin_scraper-master\linkedin_scraper\testje.py", line 28, in Person(linkedin_url=None, experiences=[], educations=[], driver=driver, scrape=True) File "C:\ProgramData\Anaconda3\lib\site-packages\linkedin_scraper\person.py", line 36, in init driver.get(linkedin_url) File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get self.execute(Command.GET, {'url': url}) File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id

I run Chrome 76 with a chromedriver that's compatible with Chrome 76.

joeyism commented 5 years ago

I don't have a linux computer, and I can't seem to reproduce your error. Did you have your chromedriver running multiple times when this error occured?

joeyism commented 4 years ago

Close due to lack of response