| name | linkedin |
| description | Automate LinkedIn tasks using agent-browser connected to the local Chrome browser via CDP. |
LinkedIn Browser Automation
This skill enables browser automation on LinkedIn using agent-browser connected to the local Chrome instance.
CRITICAL: Connection Setup
Chrome is already running on this machine with CDP enabled on port 9223.
IMPORTANT: localhost doesn't resolve in this environment. You MUST use 127.0.0.1.
Connect using CDP URL
Use agent-browser with the --cdp flag and the full HTTP URL:
agent-browser --cdp http://127.0.0.1:9223 <command>
NOTE: Always use http://127.0.0.1:9223, never localhost, ws://, or just a port number.
IMPORTANT: Handling Timeouts
agent-browser has a 10 second default timeout which is often too short for LinkedIn.
If navigation times out, use eval to get page content:
agent-browser --cdp http://127.0.0.1:9223 eval "document.body.innerText"
Check current URL without waiting:
agent-browser --cdp http://127.0.0.1:9223 eval "window.location.href"
Get page title:
agent-browser --cdp http://127.0.0.1:9223 get title
Recommended Workflow for LinkedIn
Step 1: Check if already on the right page
agent-browser --cdp http://127.0.0.1:9223 eval "window.location.href"
Step 2: Navigate if needed (ignore timeout errors)
agent-browser --cdp http://127.0.0.1:9223 open https://www.linkedin.com/in/me/ 2>&1 || true
Step 3: Wait a moment for content to load
sleep 3
Step 4: Get page text content (faster than snapshot)
agent-browser --cdp http://127.0.0.1:9223 eval "document.body.innerText"
This approach is MORE RELIABLE than using snapshot because:
eval runs immediately without waiting for navigation to complete
- The page text contains all the data you need (follower counts, connection counts, etc.)
Quick Commands Reference
| Command | Purpose |
|---|
eval "document.body.innerText" | Get all visible text (FAST) |
eval "window.location.href" | Get current URL |
get title | Get page title |
open <url> 2>&1 || true | Navigate (ignore timeout) |
snapshot | Get element tree (may timeout) |
LinkedIn-Specific Patterns
My Profile - Get Follower Count
agent-browser --cdp http://127.0.0.1:9223 open https://www.linkedin.com/in/me/ 2>&1 || true
sleep 3
agent-browser --cdp http://127.0.0.1:9223 eval "document.body.innerText"
Look for patterns like:
- "1,220 followers"
- "X followers"
My Profile - Get Connection Count
Same approach - look for patterns like:
- "500+ connections"
- "653 connections"
Search for Bill Gates
agent-browser --cdp http://127.0.0.1:9223 open "https://www.linkedin.com/in/williamhgates/" 2>&1 || true
sleep 3
agent-browser --cdp http://127.0.0.1:9223 eval "document.body.innerText"
Look for "39,823,879 followers" or similar large number.
Output Format
IMPORTANT: When you find the answer, always output it clearly:
ANSWER: 1234
or
ANSWER: 39,816,349
Common Issues and Solutions
- "Timeout 10000ms exceeded": Use
eval "document.body.innerText" instead of snapshot
- Navigation hangs: Add
2>&1 || true to ignore errors, then use sleep and eval
- Page not loaded yet: Use
sleep 3 before getting content
- Numbers may have formatting: "39.8M followers" means 39,800,000
Example Complete Workflow
agent-browser --cdp http://127.0.0.1:9223 eval "window.location.href"
agent-browser --cdp http://127.0.0.1:9223 open https://www.linkedin.com/in/me/ 2>&1 || true
sleep 3
agent-browser --cdp http://127.0.0.1:9223 eval "document.body.innerText"