-
-
Notifications
You must be signed in to change notification settings - Fork 34
Browser Automation
Saros Industries edited this page Jun 28, 2025
·
1 revision
Integrate Puppeteer/Playwright for automated browser testing, web scraping, and UI validation directly within your CursorRIPERβ¦Ξ£ workflow.
Browser Automation enables:
- π§ͺ Automated testing
- πΈ Visual regression testing
- π Web scraping
- π¬ Test recording
- π± Multi-device testing
- π― E2E test automation
npm install -g @executeautomation/playwright-mcp-server# Playwright will auto-download browsers
npx playwright install
# Or specific browsers
npx playwright install chromium
npx playwright install firefox
npx playwright install webkitIn .cursor/mcp.json:
{
"mcpServers": {
"playwright": {
"command": "playwright-mcp-server",
"args": ["--headless=false"],
"env": {}
}
}
}Uncomment Browser Automation section in your framework rules.
| Command | Function | Example |
|---|---|---|
!pn |
Navigate to URL | !pn https://example.com |
!pb |
Go back | !pb |
!pf |
Go forward | !pf |
!pr |
Reload page | !pr |
| Command | Function | Example |
|---|---|---|
!pc |
Click element | !pc button.submit |
!pf |
Fill input | !pf input#email "test@example.com" |
!ps |
Select option | !ps select#country "USA" |
!ph |
Hover element | !ph .menu-item |
!pk |
Press key | !pk Enter |
| Command | Function | Example |
|---|---|---|
!ps |
Take screenshot | !ps login-page |
!pt |
Start test recording | !pt |
!pte |
End test recording | !pte |
!pa |
Assert element | !pa h1 "Welcome" |
!pw |
Wait for element | !pw .loading |
| Command | Function | Example |
|---|---|---|
!pg |
Get page content | !pg |
!pe |
Execute JavaScript | !pe "document.title" |
!pd |
Set device | !pd "iPhone 12" |
!pv |
Set viewport | !pv 1920 1080 |
| Operation | Research | Innovate | Plan | Execute | Review |
|---|---|---|---|---|---|
| Navigate | β | β | β | β | β |
| Screenshot | β | β | β | β | β |
| Read content | β | β | β | β | β |
| Click/interact | β | β | β | β | β |
| Fill forms | β | β | β | β | β |
| Test recording | β | β | β | β | β |
/execute
!pn http://localhost:3000
!ps before-changes # Baseline screenshot
# ... make UI changes ...
!ps after-changes # Comparison screenshot
!pa ".title" "New Title" # Assert changes
/plan
!pt # Start recording
!pn http://localhost:3000
!pc "a.login" # Click login link
!pf "#email" "user@test.com"
!pf "#password" "password"
!pc "button[type=submit]"
!pa ".dashboard" "visible"
!pte # End recording, generate test
/execute
# Test in Chrome
!pd "Desktop Chrome"
!pn http://localhost:3000
!ps chrome-desktop
# Test in Safari
!pd "Desktop Safari"
!pn http://localhost:3000
!ps safari-desktop
# Test mobile
!pd "iPhone 12"
!pn http://localhost:3000
!ps iphone-12
/execute
!pn http://localhost:3000/form
!pf "#name" "John Doe"
!pf "#email" "john@example.com"
!ps "#country" "United States"
!pc "input[type=checkbox]"
!pc "button.submit"
!pw ".success-message" # Wait for success
!pa ".success-message" "Form submitted"
// Symbol: Ξ₯ - Browser automation
// Define page elements
const loginPage = {
emailInput: "#email",
passwordInput: "#password",
submitButton: "button[type=submit]",
errorMessage: ".error"
};
// Use in tests
!pf loginPage.emailInput "test@example.com"
!pf loginPage.passwordInput "password"
!pc loginPage.submitButton// Baseline capture
!pn "/feature"
!ps "feature-baseline"
// After changes
!pn "/feature"
!ps "feature-current"
// Manual comparison or automated diff// Test API responses
!pe `
fetch('/api/users')
.then(r => r.json())
.then(data => console.log(data))
`// User journey test
1. Landing page
!pn "/"
!pa "h1" "Welcome"
2. Sign up flow
!pc "a.signup"
!pf "#email" "new@user.com"
!pc "button.continue"
3. Verification
!pw ".verification-sent"
!pa ".message" "Check your email"// Measure page load
!pe `
const perfData = performance.getEntriesByType('navigation')[0];
console.log('Load time:', perfData.loadEventEnd - perfData.loadEventStart);
`// Check ARIA labels
!pe `
const buttons = document.querySelectorAll('button');
buttons.forEach(btn => {
if (!btn.getAttribute('aria-label')) {
console.error('Missing aria-label:', btn);
}
});
`// Full page screenshot
!ps "full-page" --fullPage
// Element screenshot
!ps "header" --selector "header"
// Mobile viewport
!pd "iPhone 12"
!ps "mobile-view"/screenshots/
βββ baseline/
β βββ desktop/
β βββ mobile/
βββ current/
βββ diff/
// Capture states
!ps "state-1"
// ... make changes ...
!ps "state-2"
// Use image diff tools for comparisonError: Executable doesn't exist
Solution:
npx playwright installError: No element matches selector
Solution:
- Verify selector is correct
- Add wait for element
- Check if element is in iframe
Error: Timeout 30000ms exceeded
Solution:
// Increase timeout
!pw ".slow-element" --timeout 60000
// Or wait for specific state
!pw ".element" --state visibleWorks in headful, fails in headless
Solution:
- Set viewport size explicitly
- Add wait conditions
- Check for visual-only elements
// Good selectors
β
[data-testid="submit-button"]
β
button[aria-label="Submit form"]
β
#unique-id
// Avoid
β div > div > button
β .css-12xyz
β :nth-child(3)// Wait for element
!pw ".loading" --state hidden
// Wait for network
!pw --networkidle
// Custom wait
!pe "await new Promise(r => setTimeout(r, 1000))"// Check element exists before interaction
!pe "document.querySelector('.element') !== null"
!pc ".element"
// Try-catch in execute
!pe `
try {
await page.click('.might-not-exist');
} catch (e) {
console.log('Element not found, continuing...');
}
`/tests/
βββ e2e/
β βββ auth.test.js
β βββ checkout.test.js
β βββ user-flow.test.js
βββ visual/
β βββ desktop.test.js
β βββ mobile.test.js
βββ fixtures/
βββ test-data.json
// Page coverage
!pe `
const links = document.querySelectorAll('a');
console.log('Total links:', links.length);
console.log('Tested:', testedLinks.size);
`// Core Web Vitals
!pe `
const metrics = {
FCP: performance.getEntriesByName('first-contentful-paint')[0],
LCP: performance.getEntriesByType('largest-contentful-paint')[0],
CLS: /* Calculate CLS */
};
console.log(metrics);
`Browser tests update:
- Οβ (progress.md) - Test results
- Οβ (activeContext.md) - Current test focus
## Test Coverage [βοΈΟβ
:Tβ]
- Authentication flow: β
Passing
- Checkout process: β
Passing
- Mobile responsive: β οΈ 2 failures// !ct TEST - E2E Test Suite
describe('Authentication', () => {
test('login flow', async () => {
// Test implementation
});
});
// !ct END-T// Pause execution
!pe "await page.pause()"
// Debug mode
!pn "http://localhost:3000" --debug
// Slow motion
!pn "http://localhost:3000" --slowMo 500// Mock API responses
!pe `
await page.route('/api/users', route => {
route.fulfill({
status: 200,
body: JSON.stringify([{id: 1, name: 'Test'}])
});
});
`// Set cookies
!pe `
await context.addCookies([{
name: 'session',
value: 'test-session',
domain: 'localhost',
path: '/'
}]);
`// Handle downloads
!pe `
const [download] = await Promise.all([
page.waitForEvent('download'),
page.click('a.download-link')
]);
console.log('Downloaded:', await download.path());
`- ποΈ Framework Overview
- π RIPER Modes
- πΎ Memory System
- π£ Symbolic Notation
- π Phase Management
- π‘οΈ Code Protection
- π Context References
- π Permission System
- π Cross-References
- πΎ Backup System
- π Mode Transitions
- πΎ Memory Management
- π‘οΈ Protection Workflow
- π Context Management
- π₯ Team Collaboration
- π£ Symbol Reference
- β¨οΈ Command Reference
- π Mode Reference
- π Permission Matrix
- π API Reference
- π Overview
- π GitHub Integration
- π Web Search
- π Browser Automation
- π³ Docker Integration
-
Installation Issues
- Node.js Version Compatibility
- Package Installation Failures
- Framework Dependencies Missing
- Database Connection Issues
- Port Conflicts
- Environment Setup Issues
- Build and Development Issues
- Framework CLI Issues
-
Configuration & Runtime Issues
- Framework Configuration Problems
- Runtime Performance Issues
- Module Loading and Plugin Issues
- Database and Storage Issues
- Memory Leaks and High Memory Usage
- High CPU Usage
-
BMAD Module Issues
- BMAD Module Initialization Problems
- Business Model Canvas Issues
- Stakeholder Management Issues
- Analytics and Reporting Issues
- Performance Optimization
-
Database & API Issues
- Database Connection Problems
- Database Migration Issues
- API Performance and Reliability Issues
- Data Consistency Issues
- Transaction Problems
-
Performance & Memory Issues
- Memory Management
- CPU Optimization
- Database Query Performance
- Caching Issues
- Resource Monitoring
-
Security & Authentication Issues
- Authentication Failures
- Authorization Problems
- JWT Token Issues
- Session Management
- CORS and Security Headers
- SSL/TLS Configuration
-
Deployment & Production Issues
- Production Deployment Failures
- Environment Configuration
- Load Balancing Issues
- Monitoring and Logging
- Backup and Recovery
When reporting issues, please include:
- Framework version (
npm list @cursoriper/core) - Node.js version (
node --version) - Operating system and version
- Error messages and stack traces
- Steps to reproduce the issue
- Configuration files (sanitized)
- Recent changes or deployments
- Technical Support: support@cursoriper.com
- Documentation: https://docs.cursoriper.com
- Community Forum: https://community.cursoriper.com