A sophisticated Go application for automating LinkedIn login and interactions with human-like behavior simulation using the Rod browser automation library.
This project uses Rod to automate browser interactions with LinkedIn. It features advanced stealth techniques including random mouse movements, natural scrolling patterns, and realistic typing speeds to avoid detection by anti-bot systems.
- Automated LinkedIn Login - Logs into LinkedIn with email/password credentials
- Human-like Behavior Simulation:
- Random mouse movements (3-5 movements with natural pauses)
- Random page scrolling (3-5 scrolls with reading time)
- Realistic typing speeds
- Random delays between actions (simulating human reaction time)
- Stealth Fingerprint Masking - Masks automation indicators to avoid detection
- Comprehensive Logging - Detailed logs of all actions performed
- Browser Automation - Full control over browser interactions using Rod library
- Environment-based Credentials - Secure credential management via .env file
- Go 1.24.5 or higher
- Chrome/Chromium browser (Rod will auto-download if not present)
- Windows Defender exclusion (optional, see troubleshooting)
- .env file with LinkedIn credentials
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/linkedin-automation.git
cd linkedin-automation- Install dependencies:
go mod tidy- Create a
.envfile in the project root:
LINKEDIN_EMAIL=your_email@example.com
LINKEDIN_PASSWORD=your_password- Build the project (optional):
go build# Verify Go is installed
go version # Should be 1.24.5 or higher
# Verify you're in the project directory
cd linkedin-automation
ls -la # Should show main.go, README.md, go.mod, etc.# Step 1: Download dependencies
go mod tidy
# Step 2: Create credentials file (.env)
# On Windows (PowerShell):
@"
LINKEDIN_EMAIL=your_email@example.com
LINKEDIN_PASSWORD=your_password
"@ | Out-File -Encoding UTF8 .env
# On Linux/Mac:
cat > .env << EOF
LINKEDIN_EMAIL=your_email@example.com
LINKEDIN_PASSWORD=your_password
EOF
# Step 3: Verify .env file exists
ls -la .env # Should show .env file
# Step 4: Run the application
go run main.go- 0-2 seconds: "Starting LinkedIn Automation" log appears
- 2-3 seconds: Browser window launches (Chrome opens)
- 3-5 seconds: Navigates to LinkedIn login page
- 5-15 seconds: Enters credentials and logs in (watch it type)
- 15-20 seconds: "Login Successful" message appears
- 20-25 seconds: Mouse movements visible on page (cursor moving)
- 25-30 seconds: Page scrolls up and down automatically
- 30+ seconds: Browser stays open showing home page
Run the application:
go run main.go- Loads credentials from the
.envfile - Launches a Chrome browser in non-headless mode (visible)
- Navigates to LinkedIn login page
- Performs automated login with human-like delays
- Verifies successful login by checking page URL
- Applies fingerprint masking to avoid detection
- Simulates human behavior:
- Random mouse movements across the page
- Random scrolling with natural pauses
- Realistic timing between all actions
- Keeps browser open for 30+ seconds showing the results
[2025-12-24 19:08:28] INFO: Starting LinkedIn Automation
[2025-12-24 19:08:29] INFO: Opening Linkedin Login page
[2025-12-24 19:08:30] INFO: Locating email input field
[2025-12-24 19:08:31] INFO: Locating password input field
[2025-12-24 19:08:32] INFO: Locating and clicking on sign in button
[2025-12-24 19:08:33] INFO: Checking if login was successful
[2025-12-24 19:08:34] INFO: Login Successful - Redirected to home page
[2025-12-24 19:08:35] INFO: Applying fingerprint masking...
[2025-12-24 19:08:36] INFO: Starting human-like behavior simulation...
[2025-12-24 19:08:37] INFO: Performing stealth actions - simulating human-like behavior
[2025-12-24 19:08:38] INFO: Executing random mouse movements...
[2025-12-24 19:08:39] INFO: Executing random page scrolling...
[2025-12-24 19:08:40] INFO: Stealth actions completed
Before running the application, verify:
- Go 1.24.5+ is installed:
go version - You're in the project directory:
pwdorcd linkedin-automation - Dependencies are installed:
go mod tidy -
.envfile exists with credentials:cat .env -
.envhas valid LinkedIn email and password - Chrome/Chromium is installed (or let Rod download it)
- No other applications are using port 9222 (Rod's default debugging port)
- Windows Defender isn't blocking Rod (add exclusion if needed)
# Install go-task or use go run directly
go run main.go# Build executable
go build -o linkedin-automation.exe
# Run the executable
./linkedin-automation.exe# Smaller binary size
go build -ldflags="-s -w" -o linkedin-automation.exe
# Run it
./linkedin-automation.exe# Build for Windows (if on Windows)
go build -o linkedin-automation.exe
# Build for Linux (if on Linux/Mac)
go build -o linkedin-automation
# Build for macOS (if on Mac)
go build -o linkedin-automation
# Cross-compile Windows binary from Linux/Mac
GOOS=windows GOARCH=amd64 go build -o linkedin-automation.exego build
# Should complete with no errors
ls -la linkedin-automation.exe # File should existA. Verify Credential Loading
go run main.go
# Check logs for: "Starting LinkedIn Automation"
# Check that browser launchesB. Verify LinkedIn Login
- Watch the browser window
- See email field being filled automatically
- See password field being filled automatically
- See the "Sign in" button being clicked
- Wait for page to load and check logs for "Login Successful"
C. Verify Mouse Movements ✅
- After login, watch the mouse cursor on the page
- You should see the cursor move to 3-5 different positions
- Each movement is followed by a 300-800ms pause
- Check logs for: "Executing random mouse movements..."
D. Verify Page Scrolling ✅
- After mouse movements, watch the page scroll
- Page should scroll down 3-5 times
- Each scroll is 200-600 pixels
- Followed by 800-1500ms pause (reading time)
- Check logs for: "Executing random page scrolling..."
E. Verify Logging
- Check that every action is logged
- Look for log format:
[TIMESTAMP] INFO: Action name - Verify no ERROR messages in logs
# Edit .env with test account
# Run again
go run main.go
# Verify it works with different credentials# Build the project
go build
# Run the executable instead of 'go run'
./linkedin-automation.exe
# Should work identically to 'go run main.go'- Browser launches automatically
- Credentials are entered without user interaction
- Login completes successfully
- Mouse movements are visible on the page
- Page scrolling occurs automatically
- All actions are logged with timestamps
- No error messages in console
- Program completes without crashing
- Browser closes cleanly when done
linkedin-automation/
├── main.go # Entry point - orchestrates the automation workflow
├── go.mod # Go module definition
├── go.sum # Dependency checksums
├── .env # Environment variables (credentials)
├── README.md # This file
│
├── internal/
│ ├── automation/
│ │ └── login.go # LinkedIn login automation logic
│ │
│ ├── browser/
│ │ ├── browser.go # Browser initialization, page opening, stealth actions
│ │ └── fingerprint.go # Anti-detection fingerprint masking
│ │
│ ├── logger/
│ │ └── logger.go # Centralized logging utility
│ │
│ ├── stealth/
│ │ ├── delay.go # Random delay generation for human-like timing
│ │ ├── mouse.go # Random mouse movement simulation (3-5 movements)
│ │ ├── scroll.go # Random page scrolling simulation (3-5 scrolls)
│ │ └── typing.go # Human-like typing speed simulation
│ │
│ ├── storage/
│ │ └── state.go # Application state persistence
│ │
│ ├── config/ # Configuration management
│ └── models/ # Data models
│
└── pkg/
├── models/ # Public data models
└── utils/ # Public utility functions
tests/ # Test files
Create a .env file in the project root with your LinkedIn credentials:
LINKEDIN_EMAIL=your_email@example.com
LINKEDIN_PASSWORD=your_password.env files to version control. Add it to .gitignore.
Edit internal/browser/browser.go to customize:
- Headless mode: Change
Headless(false)toHeadless(true)for invisible browsing - Browser binary: Set custom Chrome path with
.Bin("/path/to/chrome") - Additional flags: Add launcher flags as needed
Customize behavior simulation in:
- internal/stealth/delay.go - Adjust delay ranges
- internal/stealth/mouse.go - Adjust movement ranges (lines 7-8)
- internal/stealth/scroll.go - Adjust scroll ranges (lines 7-8)
- internal/stealth/typing.go - Typing speed parameters
- Performs 3-5 random mouse movements
- Coordinates range: X(100-800px), Y(100-600px)
- Pause between movements: 300-800ms
- Avoids corners to appear natural
- Performs 3-5 random scroll actions
- Scroll distance per action: 200-600 pixels
- Pause between scrolls: 800-1500ms
- Mimics human reading behavior
- Realistic keystroke delays between characters
- Variable speed based on character type
- Occasional typos and corrections (optional)
- Login field detection: 800-1500ms delay
- Form submission: 1000-2000ms delay
- Page load verification: 3000-5000ms delay
- All delays are randomized to appear natural
Problem: Application exits with error about missing .env file
Solution:
# Verify .env exists in project root
ls -la .env
# If missing, create it
echo "LINKEDIN_EMAIL=your_email@example.com" > .env
echo "LINKEDIN_PASSWORD=your_password" >> .env
# Verify contents
cat .envProblem: Go is not installed or not in PATH
Solution:
# Check if Go is installed
go version
# If not, download from https://golang.org/dl/
# Add Go to your PATH environment variable
# Restart PowerShell/Terminal after installationProblem: Chrome/Chromium not installed
Solution:
# Option 1: Let Rod download Chrome automatically
# The first run will download a Chromium instance
# Option 2: Install Chrome manually
# Download from https://www.google.com/chrome/
# Option 3: Set custom Chrome path in browser.go
.Bin("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")Problem: "Operation did not complete successfully because the file contains a virus or potentially unwanted software"
Solution:
# Add exclusion to Windows Defender
Add-MpPreference -ExclusionPath "$env:TEMP\leakless-*" -Force
# Or manually:
# 1. Open Windows Security
# 2. Go to Virus & threat protection → Virus & threat protection settings
# 3. Click "Manage settings" under "Virus & threat protection settings"
# 4. Scroll down to "Exclusions"
# 5. Click "Add exclusions"
# 6. Select "Folder" and add: C:\Users\YourUsername\AppData\Local\Temp\leakless-*Problem: Email input field selector is not found
Solution:
# LinkedIn HTML may have changed
# Edit internal/automation/login.go and update the selector
emailInput, err := page.Element(`input#username`)
# To find the correct selector:
# 1. Open LinkedIn login page in Chrome
# 2. Right-click on email field → Inspect
# 3. Find the correct ID or class name
# 4. Update the selector in login.goProblem: Application runs but mouse movements and scrolling not visible
Solution:
# Check 1: Browser must be visible (non-headless)
# In browser.go, ensure:
Headless(false) # NOT true
# Check 2: Verify stealth actions are being called
# Check logs for "Executing random mouse movements..."
# If missing, check main.go has this line:
browser.PerformStealthActions(page)
# Check 3: Increase delay times in stealth files
# Edit internal/stealth/mouse.go and increase:
time.Sleep(time.Duration(1000+r.Intn(1000)) * time.Millisecond)
# Check 4: Verify page is fully loaded
# Wait longer before performing stealth actions
stealth.RandomDelay(3000, 5000) // 3-5 second waitProblem: Application takes too long to verify login
Solution:
# Check internet connection - LinkedIn may be slow
# Increase timeout in internal/automation/login.go:
timeout := time.After(60 * time.Second) // Increase to 60 seconds
# Check if LinkedIn is accessible
# Try opening LinkedIn in regular Chrome browserProblem: linkedin-automation/internal/... module not found
Solution:
# Ensure you're in the correct directory
pwd # Should end with linkedin-automation
# Reinstall dependencies
go mod tidy
go mod download
# Verify go.mod exists
ls -la go.modProblem: Another instance of the application is running
Solution:
# On Windows (PowerShell):
Get-Process | Where-Object {$_.ProcessName -like "*chrome*"} | Stop-Process
# On Linux/Mac:
pkill chrome
# Or just restart your terminal/PowerShellProblem: No error message but program closes immediately
Solution:
# Check that .env file has valid credentials
cat .env
# Check that credentials are correct
# Try logging in manually to verify they work
# Check for silent errors:
go run main.go 2>&1 | tee output.log
# This saves all output to output.log for reviewIf you see: Operation did not complete successfully because the file contains a virus or potentially unwanted software
Add an exclusion to Windows Defender:
Add-MpPreference -ExclusionPath "$env:TEMP\leakless-*" -ForceOr manually:
- Open Windows Security
- Go to Virus & threat protection settings
- Add exclusion for
%TEMP%\leakless-*
- Ensure Chrome/Chromium is installed or let Rod download it
- Check that
Headless(false)is set in browser.go - Verify no firewall is blocking the browser process
- Verify credentials in
.envfile are correct - Check that LinkedIn is accessible from your network
- Ensure the LinkedIn login page HTML selectors haven't changed
- Check console logs for specific error messages
- Ensure
Headless(false)is set (browser must be visible) - Check that
PerformStealthActions(page)is being called in main.go - Verify logger output shows stealth action messages
- Increase pause durations in stealth files if movements are too fast to see
github.com/go-rod/rod- Browser automation librarygithub.com/joho/godotenv- .env file loadinggithub.com/ysmood/leakless- Process management (included with rod)
See go.mod for complete dependencies.
Add logging to see detailed execution:
logger.Info("Your debug message")- Create new modules in the
internal/directory - Follow the existing logging patterns
- Use stealth functions to maintain natural behavior
- Test thoroughly before deployment
Add new stealth methods in internal/stealth/:
// Example: New stealth function
func RandomHover(page *rod.Page) {
// Implementation
}Then call from browser.PerformStealthActions().
✅ Best Practices:
- Use delays between actions
- Don't perform bulk operations rapidly
- Respect rate limits
- Log all activities for compliance
- Test with a dedicated account first
Feel free to submit issues and enhancement requests!
MIT License - see LICENSE file for details (if added)
Created for LinkedIn automation tasks.
- Initial release
- LinkedIn login automation
- Mouse movement simulation
- Page scrolling simulation
- Fingerprint masking
- Comprehensive logging