Update Your LinkedIn Profile with Cursor and the Playwright MCP

Keeping a LinkedIn profile current can be a tedious chore, especially when it's years out of date. This lesson demonstrates a powerful and often humorous workflow for delegating this entire task to an AI agent, using Cursor IDE's Composer combined with Playwright for robust browser automation.

You'll see a live, unscripted attempt to overhaul a severely outdated LinkedIn profile from start to finish. The process involves granting the AI control of a browser, instructing it to scrape relevant information from personal websites (like egghead.io), and then using that data to populate and update various sections of the LinkedIn profile, including the bio, work experience, and education.

Workflow and Learnings Demonstrated:

  • Initiating AI Control: Kicking off a Playwright-controlled browser session directly from a prompt in Cursor.
  • Web Scraping & Context Gathering: Guiding the AI to navigate multiple tabs, scrape biographical and professional information, and consolidate it into a structured document.
  • Automated Data Entry: Instructing the agent to fill out LinkedIn profile fields, from simple text inputs to complex forms with date pickers.
  • Handling Automation Failures: This lesson highlights the realities of AI automation, including dealing with modal dialogs, hidden file inputs, and unexpected UI behavior that can trip up an automated script.
  • Iterative Prompting & Manual Intervention: Demonstrates how to refine prompts, provide additional information (like correcting dates or providing image URLs), and step in manually when the AI gets stuck, offering a realistic look at a human-in-the-loop workflow.
  • Post-Mortem Analysis: Concludes by prompting the AI to analyze the entire conversation, identify all the failures and workarounds, and generate a new set of instructions to make the process smoother for future attempts.

This lesson provides a practical and insightful look into the capabilities and current limitations of using AI for complex web automation tasks, showcasing a workflow that blends AI-driven efficiency with necessary human oversight.

Lessons Learned Prompt

If you'd like to try this on your own, start with the prompt below to avoid many of the issues discovered in this lesson:

# Playwright + LinkedIn Automation: Lessons Learned & Best Practices ## Overview Automating LinkedIn profile updates with Playwright (especially via MCP or similar tools) can be powerful, but LinkedIn’s UI and security measures introduce unique challenges. This document summarizes failed attempts, successful workarounds, and workflow optimizations based on a real-world automation session. --- ## Common Automation Failures & Issues ### 1. **File Uploads (Profile & Banner Photos)** - **Problem:** LinkedIn often uses hidden file inputs for uploads. Clicking the visible "Upload photo" button via automation fails because pointer events are intercepted or the input is visually hidden. - **Symptoms:** - Timeout errors when clicking upload buttons. - File upload tool only works when the modal state is correctly detected. - **Workarounds:** - If automation fails, prompt the user to manually click the upload button and select the file (ensure the file is downloaded to a known location). - After manual upload, automation can resume for cropping/saving steps. ### 2. **Modal/Overlay Interference** - **Problem:** LinkedIn frequently displays modals, overlays, or dialogs (e.g., "Share your update") that block further actions. - **Symptoms:** - Clicks on "Add education" or similar buttons are intercepted or ignored. - Automation gets stuck until the modal is dismissed. - **Workarounds:** - Always check for and dismiss overlays before proceeding with the next action. - Use Playwright’s snapshot or accessibility tree to detect modal presence. ### 3. **Date and Field Inference** - **Problem:** Automation may require date fields (e.g., education start/end) that the user doesn’t remember. - **Workarounds:** - Use web search to infer missing data (e.g., law school graduation year). - Ask the user for approximate dates or permission to use reasonable defaults. ### 4. **UI Element State/Ref Changes** - **Problem:** LinkedIn’s UI is dynamic; element references (refs) can change between sessions or after modals. - **Workarounds:** - Always re-capture the page snapshot before interacting with new elements. - Avoid hardcoding refs; use semantic queries or re-query elements after UI changes. --- ## Workflow Optimizations & Best Practices 1. **Prepare All Assets in Advance** - Download images (profile, banner) to a known directory before starting automation. - Keep a local copy of all text content to be pasted into LinkedIn fields. 2. **Automate in Small, Verified Steps** - After each major action (e.g., section update), verify the UI state and check for modals. - Use Playwright’s snapshot/console to confirm the expected dialog is open. 3. **Manual Intervention Points** - Clearly document steps where automation is likely to fail (e.g., file uploads). - Provide the user with file paths and instructions for manual upload if needed. 4. **Error Handling & Recovery** - On failure, attempt to dismiss overlays and retry the action. - If repeated failures occur, log the error and suggest a manual workaround. 5. **Keep the User Informed** - Communicate what’s automated vs. what needs manual input. - Summarize what’s been completed and what’s pending after each session. --- ## Example: Optimized LinkedIn Banner Upload Workflow 1. **Download the Banner Image:** ```sh curl -L "<banner-url>" -o background-banner.jpg ``` 2. **Open LinkedIn Profile and Click "Edit Background"** 3. **If Automation Fails to Click "Upload Photo":** - Prompt the user: “Please click the ‘Upload photo’ button and select `background-banner.jpg` from your local directory.” 4. **Resume Automation:** - Once the image is uploaded, continue with cropping/saving via automation. --- ## Conclusion Automating LinkedIn with Playwright is possible but requires a hybrid approach: automate what you can, and gracefully handle or document manual steps. Always anticipate UI changes, overlays, and upload quirks. Document your workflow for future users and iterate as LinkedIn’s UI evolves.
Share with a coworker

Transcript

[00:00] Someone mentioned to me that my LinkedIn profile is just wildly out of date by 15 years or so and while I couldn't be bothered to Manually update it. I figured I'd hand it over to an AI and see what happens So I have the Playwright MCP enabled and I'll go ahead and ask it. Please use the Playwright MCP to open LinkedIn. So I'll fire this up. It should open a new browser.

[00:21] This browser being controlled by Playwright. This one is my normal Chrome browser. You can tell by the extensions here and no extensions here. Now I'd already signed into LinkedIn in a previous session so that's why it popped up signed in. Otherwise I would have had to click through the buttons to sign in.

[00:36] And we can navigate directly to my profile page. And to give this a test run we can just say I navigated to my profile page, please update my current role to be an astronaut. Then we'll sit back and let Playwright do the clicking and the typing for us. Please proceed with your plan. Switches it over to astronaut.

[00:59] Just pick whatever for now, I don't care. It's just asking for a date that I started as an astronaut. And then it looks like that worked just fine. I'm not with JetBrains anymore so I can't get access to that verification code, but that would have worked. So now what I'm going to do to update my profile is in this browser I'm going to go over to Egghead and I'll just search for myself, find my own profile.

[01:24] So I'll leave this open and I'm going to navigate to the primary things that I'm working on. So Cursor Pro and then my Egghead Workshop page and then my Egghead Newsletters page. So I have my biography, actually I can go here for a full story, and then my main course for Cursor, and my live workshops, and my newsletter that I sent out. So I'm going to start focused on this tab. I open four tabs.

[01:50] Please scrape my profile and essentially my resume from this how to egghead tab, the one that's currently focused. And then once you're done go to the next tab to find out information about my cursor course I'm working on, then go to the next tab to grab in information about my live workshop, and then the final tab to give information about my newsletter, then collate that all into a markdown document in the root called something like LinkedIn profile, and then we'll review that together. So then I'll just sit back and let this build up a profile for me. Since Playwright can list tabs and select tabs and take snapshots of each page, you'll see it go through each one and take snapshots. So now we have this LinkedIn profile document all set up, which I could review just at a quick glance.

[02:37] That looks fine to me. So then if we swap back over to our conversation, I'll just say, please update my LinkedIn profile with this profile that you generated. Then it navigates back over. It's asking me specific questions. I'll just say, just do your best, just make sure and fill out everything based on the information you have.

[02:56] If you feel like anything is missing, we'll go find that together later. So it did pause after that initial step. I'm going to tell it, yes, please proceed with completing my entire profile, filling out everything possible, and don't worry about asking me again until the entire profile is filled out. So now it's opening the profile prompt and I'm just going to sit back and let this run. So my about section is now done.

[03:25] Please proceed with the next changes. Now I do have a shortcut on my system. If the agent ever stops I can just hit Alt P and it'll paste in a prompt that says I'm away from keyboard so just keep on working on this. It saves me from dictating that. I try and add it into the cursor rules but we're working from a completely blank project right now.

[03:44] It filled out my education. I guess I didn't include any education in my bio. I'll have to go back and add that. So I'm going to say, please add that I have a bachelor's in technical writing from the University of Alaska Anchorage. That's where I grew up.

[03:58] And then I attended law school at the University of Utah. You can search the web for my law school profile. I forget which year my class graduated. And then just like infer the other dates for my schooling from that. And we'll see how this does.

[04:12] Again, I take an attitude of just forge ahead, see if it works. If it doesn't work, then next time you'll be better at it because you'll learn what doesn't work. Now it looks like this is way off on the year that I attended school. I am not that old, which is fine. I'll go back and fix that later.

[04:28] I'm actually going to check the web search it did up here to see what the results are. I went and did a manual search of my law school. Apparently they keep a Flickr album and they misspelled my last name. So that's my ugly mug from a while ago. I couldn't understand why they didn't find it.

[04:45] There is definitely supposed to be a D in Lindquist. Anyway, so that was 2008. Let's check where we're at. So the dates for my schooling were way off. Law school was 2005 to 2008, which means that my bachelor's would have been 2001 to 2004 or something like that.

[05:01] So please update those and then continue with the rest of the tasks All right, it looks like it can't update something it's probably this pop-up getting in the way So now I just have to go in and delete stuff. I definitely wasn't an astronaut So click here delete sure Deleting is way more fun than writing anyway. Click here, I'm definitely not an astronaut. Save. And since we don't have a profile picture, let's make an attempt of like going here.

[05:27] I'll just right-click on this and copy image address, navigate back, paste the address, and if you just paste normally it'll try and scrape that site. So if you want a URL where it doesn't paste that at symbol do command shift V and then I'll just ask it please download this image and then use it as my profile picture on LinkedIn. Now honestly I don't know if this is any faster than me right-clicking on the image and then clicking that button and then uploading it, but it's definitely way cooler. So that turned out just fine and then I actually really like using my egghead logo as background on social medias so I'm gonna right-click on this, copy the image address, and go back and please use this as my background photo or banner photo or whatever it's called. There is a giant upload photo button on the screen.

[06:14] Go ahead and click that and that should enable you to add the cover image. Now it's actually a hidden file input so we'll click that ourselves and that's correct I'm not getting any sort of pop-up. So this just means on a normal browser that if you click this button it's going to open this dialog. So I'll just do this manually the old boring way. Apply.

[06:34] And then I think that's pretty much all I want to do. We could dig in deeper and ask it to try and optimize profile and about and career and all that stuff if we were concerned with being found on LinkedIn. But for me, the most interesting thing is this conversation that we had, where I can ask it, please look back through this conversation. Find everything we tried that failed, and then the workarounds, especially when it comes to Playwright, and then write out a document that would optimize these workflows for anyone who'd want to try this in the future. So I'll go ahead and get this written out, and I'll share this document.

[07:09] If anyone wants to try this exact same thing, if you include this document in your initial prompt it should go much faster for you than it did for me. So to briefly check out this document, it talks about file uploads failing, modals and overlays it ran into, being aware that we'll need dates for things, and the information of how to approach this task if we're going to do it all over again.