@stacksleuth/browser-agent
v0.2.4
Published
Advanced browser automation and performance monitoring agent - Playwright/Puppeteer integration, website crawling, user interaction simulation, screenshot capture, and real-time debugging capabilities.
Maintainers
Readme
@stacksleuth/browser-agent
StackSleuth Browser Agent
🚀 What is StackSleuth Browser Agent?
Advanced browser automation and performance monitoring agent - Playwright/Puppeteer integration, website crawling, user interaction simulation, screenshot capture, and real-time debugging capabilities.
✨ Key Features
- 🌐 Browser Automation: Playwright and Puppeteer integration
- 🕷️ Website Crawling: Automated website performance analysis
- 👤 User Interaction Simulation: Realistic user behavior testing
- 📷 Screenshot Capture: Visual regression and performance testing
- 🔍 Real-time Debugging: Live browser debugging capabilities
- 📊 Performance Metrics: Core Web Vitals and custom metrics
- 🎯 Load Testing: Automated performance testing workflows
- ⚡ Headless & GUI Mode: Flexible testing environments
📦 Installation
# npm
npm install @stacksleuth/browser-agent
# yarn
yarn add @stacksleuth/browser-agent
# pnpm
pnpm add @stacksleuth/browser-agentyarn add @stacksleuth/browser-agentpnpm add @stacksleuth/browser-agent🏁 Quick Start
import { BrowserAgent } from '@stacksleuth/browser-agent';
// Initialize browser agent
const agent = new BrowserAgent({
enabled: true,
browser: 'chromium', // or 'firefox', 'webkit'
headless: true
});
// Start monitoring
await agent.startMonitoring();
// Create a new session
const session = await agent.createSession({
url: 'https://example.com',
waitUntil: 'networkidle'
});
// Simulate user interactions
await session.click('button#login');
await session.type('input[name="username"]', 'testuser');
await session.type('input[name="password"]', 'password');
await session.click('button[type="submit"]');
// Capture performance metrics
const metrics = await session.getPerformanceMetrics();
console.log('Performance:', metrics);
// Take screenshot
await session.screenshot('login-page.png');🛠️ Troubleshooting
Common Issues
Agent Not Starting
// Enable debug mode
const agent = new BrowserAgent({
enabled: true,
debug: true
});High Memory Usage
// Optimize memory usage
const agent = new BrowserAgent({
bufferSize: 500,
flushInterval: 5000,
sampleRate: 0.01
});Missing Metrics
- Check that the agent is enabled
- Verify your API key and project ID
- Ensure sampling rate allows data through
- Check network connectivity to StackSleuth API
Debug Mode
DEBUG=stacksleuth:* node your-app.js📚 Resources
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
📄 License
MIT License - see the LICENSE file for details.
Website • Documentation • NPM Registry • GitHub
Made with ⚡ by StackSleuth
