[Python] Scraping of Linkedin post [closed]

Discussão em 'Python' iniciado por Stack, Julho 2, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working on automating the scraping of LinkedIn posts using Selenium and Python. My goal is to extract the post URL from LinkedIn posts by interacting with the "More options" (•••) dropdown menu and selecting "Copy link to post".

    I have successfully located the posts and their content, but I'm having trouble identifying the correct XPath for the "Copy link to post" option within the dropdown menu.

    Here's the basic flow I am trying to automate:

    Open the LinkedIn post page.

    Click on the More options (•••) button.

    Select the Copy link to post option.

    Get the copied URL from the clipboard.

    I've tried using XPaths like:

    xpath

    //span[text()='Copy link to post']/ancestor::div[contains(@class, 'artdeco-dropdown__item')]

    But it doesn't seem to work consistently across all posts. The Copy link to post option sometimes doesn't appear, or the XPath is unable to locate the element.

    Questions:

    How do I accurately find the XPath for the "Copy link to post" element in the LinkedIn post dropdown menu?

    Are there any specific strategies or dynamic waits I should use to make sure the dropdown menu is fully loaded before selecting the copy link option?

    Any help or guidance on this would be greatly appreciated!

    Continue reading...

Compartilhe esta Página