Search code examples
pythonselenium-webdriverweb-scrapinglinkedin-api

How do I get company names that individuals work for on Linkedin using python and selenium?


I'm writing code to scrap data from sites like LinkedIn and in the process of doing so, I wasn't able to extract the company name even though I'd followed through on the expected format of using XPATH's inbuilt class nodes.

I tried the following line of code to scrap the company name from each profile:

company=driver.find_element(By.XPATH,'//ul[@class="pv-text-details_right-panel"]').text

It produced no error. How do I fix this?


Solution

  • Use this xpath:

    (//ul[@class='pv-text-details__right-panel']//div)[1]