joeyism / linkedin_scraper

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

NoSuchElementException - Unable to locate element: {"method":"tag name","selector":"span"} #183

Open FarzadAvari opened 1 year ago

FarzadAvari commented 1 year ago

Hello,

I was running the below code to scrape a profile but couldn't scrape and got the below mentioned error. I would request you to please help me resolve my error and point out my mistake if any. Thank you in advance.

`from linkedin_scraper import Person, actions from selenium import webdriver driver = webdriver.Chrome()

email = 'abc@gmail.com' password = 'abc123' actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal

person = Person("https://www.linkedin.com/in/rohit-kumar-verma-3a794238/",driver=driver,scrape=True,close_on_complete=False) driver.implicitly_wait(10) person.scrape() ` Output: NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"span"} (Session info: chrome=114.0.5735.199); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: Backtrace: GetHandleVerifier [0x010FA813+48355] (No symbol) [0x0108C4B1] (No symbol) [0x00F95358] (No symbol) [0x00FC09A5] (No symbol) [0x00FC0B3B] (No symbol) [0x00FB9AE1] (No symbol) [0x00FDA784] (No symbol) [0x00FB9A36] (No symbol) [0x00FDAA94] (No symbol) [0x00FEC922] (No symbol) [0x00FDA536] (No symbol) [0x00FB82DC] (No symbol) [0x00FB93DD] GetHandleVerifier [0x0135AABD+2539405] GetHandleVerifier [0x0139A78F+2800735] GetHandleVerifier [0x0139456C+2775612] GetHandleVerifier [0x011851E0+616112] (No symbol) [0x01095F8C] (No symbol) [0x01092328] (No symbol) [0x0109240B] (No symbol) [0x01084FF7] BaseThreadInitThunk [0x76C500C9+25] RtlGetAppContainerNamedObjectPath [0x77837B4E+286] RtlGetAppContainerNamedObjectPath [0x77837B1E+238]

amitbhargav0404 commented 1 year ago

same problem here ....

FarzadAvari commented 1 year ago

Could it be because LinkedIn stopped allowing web scrapping from their page ?

Kiru6ik commented 1 year ago

What version of linkedin_scraper are you using? Try updating to the latest version. Can you provide the whole error message with the reference to the lines that cause problem? It might be covered in #173

amitbhargav0404 commented 1 year ago

`from linkedin_scraper import Person, actions from selenium import webdriver driver = webdriver.Chrome()

email = "Testssk1@gmail.com" password = "#888dd88d8d8" actions.login(driver, email, password) person = Person("https://in.linkedin.com/in/amit-bhargav", driver=driver)

person_scrape=person.scrape() print(person_scrape)

driver.close()`

NoSuchElementException Traceback (most recent call last) Cell In[1], line 8 6 password = "##888dd88d8d8" 7 actions.login(driver, email, password) ----> 8 person = Person("https://in.linkedin.com/in/amit-bhargav", driver=driver) 10 person_scrape=person.scrape() 11 print(person_scrape)

File ~/.local/lib/python3.8/site-packages/linkedin_scraper/person.py:64, in Person.init(self, linkedin_url, name, about, experiences, educations, interests, accomplishments, company, job_title, contacts, driver, get, scrape, close_on_complete, time_to_wait_after_login) 61 self.driver = driver 63 if scrape: ---> 64 self.scrape(close_on_complete)

File ~/.local/lib/python3.8/site-packages/linkedin_scraper/person.py:89, in Person.scrape(self, close_on_complete) 87 def scrape(self, close_on_complete=True): 88 if self.is_signed_in(): ---> 89 self.scrape_logged_in(close_on_complete=close_on_complete) 90 else: 91 print("you are not logged in!")

File ~/.local/lib/python3.8/site-packages/linkedin_scraper/person.py:285, in Person.scrape_logged_in(self, close_on_complete) 280 driver.execute_script( 281 "window.scrollTo(0, Math.ceil(document.body.scrollHeight/1.5));" 282 ) ...

17 0x55f064fd86b8

18 0x55f064fd8847

19 0x55f064fe8243

20 0x7f4ad1eff609 start_thread

FarzadAvari commented 1 year ago

My error is also pointing to the below mentioned line. I have updated the libraries to the latest ones. Yet getting this error.

person = Person("https://www.linkedin.com/in/rohit-kumar-verma-3a794238/",driver=driver,scrape=True,close_on_complete=False)