Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Browser Challenge Solver ๐Ÿค–

Fast hybrid browser automation agent (heuristics + optional LLM) that solves 30+ navigation challenges quickly and reliably.

๐ŸŽฏ Challenge

Solve all 30 challenges on this website in under 5 minutes.

Our Result: โœ… 30/30 challenges in ~40-50 seconds (hybrid mode)

๐Ÿš€ Quick Start

# Install dependencies
npm install

# Run the agent
npm start

๐Ÿ“Š Performance

  • Time: 40-60 seconds for 30 challenges
  • Success Rate: 100%
  • Heuristics: 80-95% of challenges (no LLM)
  • LLM Fallback: 5-20% of challenges (optional)
  • Cost: < $0.01 (with Groq)

๐Ÿ—๏ธ Architecture

Two-Phase Approach

Phase 1: Heuristics (Primary - No LLM)

  1. Dismiss all popups aggressively
  2. Scroll main page + modals
  3. Click radio buttons & checkboxes
  4. Extract & type 6-character codes
  5. Click submit โ†’ navigation buttons
  6. Verify step progression

Phase 2: LLM Fallback (Only when needed)

  • Minimal context extraction
  • Groq Llama 3.1 8B Instant
  • Forced JSON response
  • Temperature: 0 (deterministic)

๐Ÿ“ Project Structure

โ”œโ”€โ”€ agent-bruteforce.js    # โญ Main hybrid agent (heuristics + LLM fallback)
โ”œโ”€โ”€ agent-llm.js            # LLM-only approach (for comparison)
โ”œโ”€โ”€ agent-*.js              # Other experimental agents
โ”œโ”€โ”€ compare.js              # Results comparison script
โ”œโ”€โ”€ package.json            # Dependencies & scripts
โ”œโ”€โ”€ .env                    # API configuration
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ RESEARCH.md         # Automation techniques research
โ”‚   โ”œโ”€โ”€ README-LLM.md       # LLM experiment analysis
โ”‚   โ””โ”€โ”€ README-FINAL.md     # Detailed solution docs
โ”œโ”€โ”€ results/               # Performance metrics (ignored by git)
โ””โ”€โ”€ logs/                  # Runtime logs (ignored by git)

๐ŸŽฎ Available Commands

npm start              # Run hybrid agent (recommended)
npm run bruteforce     # Same as start
npm run llm            # Run LLM-only agent
npm run compare        # Compare different agents

๐Ÿ”ง Configuration

Create a .env file:

LLM_SERVICE_ENDPOINT="https://api.groq.com/openai/v1"
LLM_SERVICE_API_KEY="your-groq-api-key"
LLM_SERVICE_GENERAL_MODEL_NAME="groq/llama-3.1-8b-instant"

Get a free Groq API key at console.groq.com

Optional runtime tuning:

LLM_MAX_CALLS=30
LLM_MAX_CALLS_PER_STEP=1
LLM_MIN_CALLS_PER_RUN=1
LLM_MIN_CALLS_PER_STEP=1
LLM_ALWAYS_ON=true
LLM_USE_CACHE=false
LLM_TIMEOUT_MS=2000
USE_SESSION_CODE=true
KEEP_BROWSER_OPEN=true
CHALLENGE_URL="https://serene-frangipane-7fd25b.netlify.app"

๐Ÿ’ก Key Features

Heuristic Strategy

  • โœ… Aggressive popup dismissal - Clicks all dismiss/close/accept buttons
  • โœ… Modal scrolling - Scrolls within dialogs to reveal hidden content
  • โœ… Element interaction - Handles radios, checkboxes, inputs
  • โœ… Code extraction - Finds 6-char codes via regex: /\b[A-Z0-9]{6}\b/g
  • โœ… Smart navigation - Clicks submit โ†’ navigation in correct order

LLM Fallback (Optional)

  • โœ… Minimal usage - Only when brute force fails
  • โœ… Fast inference - Groq's Llama 3.1 8B (~0.3-0.5s per call)
  • โœ… Cheap - < $0.005 total cost
  • โœ… Reliable - Forced JSON response format

Always-On LLM (Configurable)

Enable LLM_ALWAYS_ON=true and LLM_MIN_CALLS_PER_RUN=1 to guarantee Groq usage and provide step-by-step navigation assistance. Use LLM_MIN_CALLS_PER_STEP=1 to ensure at least one LLM call per challenge.

Detailed Logging

๐Ÿ“ Step 1...
   ๐Ÿ“‹ Page state:
      Modals: 1, Radios: 3, Checkboxes: 0, Inputs: 1
   ๐Ÿ”จ Brute forcing...
   โœ“ Selected radio button
   ๐Ÿ”‘ Found codes: ABC123
   โœ“ Typed code: ABC123
   โœ“ Clicked: Submit
   โœ“ Clicked: "next"
   โœ… Brute force SUCCESS! 1 โ†’ 2

๐Ÿ“ˆ Results

Results are written to results/results-hybrid.json by default.

Brute-Force Agent

{
  "totalDuration": "45.23 seconds",
  "totalChallenges": 30,
  "bruteForceSuccesses": 27,
  "llmFallbacks": 3,
  "totalCost": "$0.004",
  "success": true
}

Comparison with Other Approaches

Agent Time LLM Calls Cost Success
Brute Force 45s 3 $0.004 โœ… 30/30
LLM-Only 52s 30 $0.008 โœ… 30/30
Heuristic 33s 0 $0 โŒ Stuck

๐ŸŽ“ How It Works

Challenge Patterns

Pattern 1: Code Entry

Scroll โ†’ Extract code โ†’ Type โ†’ Submit โ†’ Navigate

Pattern 2: Modal Selection

Dismiss popups โ†’ Scroll modal โ†’ Select radio โ†’ Submit & Continue

Pattern 3: Multi-Step

Fill form โ†’ Submit โ†’ Wait โ†’ Navigate

Code Extraction

// Finds all 6-character alphanumeric codes
const codes = text.match(/\b[A-Z0-9]{6}\b/g);
// Example: ["ABC123", "XYZ789"]

Modal Scrolling

// Scrolls within modals to reveal hidden content
document.querySelectorAll('[role="dialog"], .modal').forEach(modal => {
  modal.scrollTop += 300;
});

๐Ÿ“š Documentation

๐Ÿ”ฌ Research

Used BrightData to research:

  • Puppeteer vs Selenium performance
  • Modal & popup handling techniques
  • Speed optimization strategies
  • Element interaction best practices

Key findings:

  • Puppeteer is 2-3x faster than Selenium
  • Brute force solves 80-90% of challenges
  • Modal scrolling is critical for hidden content
  • LLM fallback provides reliability

๐Ÿš€ Future Improvements

  1. Parallel Execution - Solve multiple challenges simultaneously
  2. Pattern Caching - Remember successful strategies
  3. Computer Vision - Use screenshots for element detection
  4. Stealth Mode - Bypass bot detection

๐Ÿ› Troubleshooting

Agent gets stuck

  • Check logs for page state (modals, radios, inputs)
  • Verify codes are being extracted
  • Ensure popups are dismissed

LLM errors

  • Verify .env has correct API key
  • Check Groq API status
  • Ensure model name is correct

๐Ÿ“ License

MIT

๐Ÿ™ Acknowledgments

  • Groq - Fast LLM inference
  • Puppeteer - Browser automation
  • BrightData - Web research capabilities

Built with โค๏ธ using Node.js, Puppeteer, and Groq LLM

Challenge completed in under 1 minute! ๐ŸŽ‰

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages