joeyism / linkedin_scraper

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

Issue when trying to fetch company: Unable to locate element #169

Open nicofeals opened 1 year ago

nicofeals commented 1 year ago

When using the Company class to search for a company, I get an error, even though I followed the given example

options = Options()
print('Init driver')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

email = "xxx"
password = "xxx"
actions.login(driver, email, password)
company = Company("https://www.linkedin.com/company/google", driver=driver)

And I get this error:

 Message: no such element: Unable to locate element: {"method":"css selector","selector":".artdeco-card.p5.mb4"}

This seems to happen with any company profile

BrentLeemans commented 1 year ago

That's because LinkedIn updated their UI again. The current version of the scraper is not working anymore as of now.

liutiming commented 1 year ago

I concur. Could someone else also confirm the above? :)

ahmadjanan commented 1 year ago

Yup, not working anymore. Facing the same error.

Kiru6ik commented 1 year ago

I was unable to find the new selector name, but its XPath is: /html/body/div[5]/div[3]/div/div[2]/div/div[2]/main/div[2]/div/div/div[1]/section . So you can just replace line 210 in the company.py to grid = driver.find_element(By.XPATH, "/html/body/div[5]/div[3]/div/div[2]/div/div[2]/main/div[2]/div/div/div[1]/section")

Also general thought, linked in changed class names changing t to b. Also I changed code in another place line 241: grid = driver.find_element(By.CLASS_NAME, "mb1")//it was mt1 before and it caused problems. Now all works fine

Kiru6ik commented 1 year ago

//update to v2.11.2 first Updates in company.py needed are:

Change class name to mb6 in line 210: grid = driver.find_element(By.CLASS_NAME, "mb6") # used to be artdeco-card.p5.mb4 Change class name to mb1 in line 241: grid = driver.find_element(By.CLASS_NAME, "mb1") # used to be mt1

Mohamed-Abdulla commented 1 year ago

iam facing the same error @Kiru6ik can you help