Lesson
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...
- Duration
- 8 min
- Access
- Free
- Transcript
- Needs source
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.