Playwright automation, Chrome DevTools debugging, and browser interaction testing. Use for E2E/unit tests, capturing screenshots, inspecting network/console logs, or validating user flows in web applications.
Playwright automation, Chrome DevTools debugging, and browser interaction testing. Use for E2E/unit tests, capturing screenshots, inspecting network/console logs, or validating user flows in web applications.
license
Complete terms in LICENSE.txt
Web Application Testing & Debugging
Comprehensive toolkit for testing and debugging web applications using Playwright automation and Chrome DevTools.
Skill Paths
Workspace skills: .github/skills/
Global skills: C:/Users/LOQ/.agents/skills/
Activation Conditions
Playwright Testing:
Testing frontend functionality in a real browser
Verifying UI behavior and interactions
Debugging web application issues
Capturing screenshots for documentation or debugging
Inspecting browser console logs
Validating form submissions and user flows
Checking responsive design across viewports
Chrome DevTools Debugging:
Interacting with web pages through automated controls
import { compareScreenshots } from'./visual-utils';
test('visual regression - home page', async ({ page }) => {
await page.goto('/');
// Wait for all images and fonts to loadawait page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
// Take screenshotconst screenshot = await page.screenshot({
fullPage: true,
});
// Compare with baselineconst diff = awaitcompareScreenshots(screenshot, 'baseline/home.png');
expect(diff.pixelDifference).toBeLessThan(100); // Threshold
});
Part 2: Chrome DevTools Integration
Tool Categories
Navigation & Page Management
// Open new pageawait chrome.newPage();
// Navigate to URLawait chrome.navigatePage('https://example.com');
// Reload current pageawait chrome.navigatePage({ action: 'reload' });
// Navigate historyawait chrome.navigatePage({ action: 'back' });
await chrome.navigatePage({ action: 'forward' });
// List all open pagesconst pages = await chrome.listPages();
await chrome.selectPage(pages[0].id);
// Close specific pageawait chrome.closePage('page-id-here');
// Wait for text to appearawait chrome.waitFor('Welcome to the site');
Input & Interaction
// Take snapshot to get element IDsconst snapshot = await chrome.takeSnapshot();
// Find element by uidconst submitButton = snapshot.elements.find(el => el.text === 'Submit');
// Click elementawait chrome.click(submitButton.uid);
// Fill single fieldawait chrome.fill(inputUid, 'value@example.com');
// Fill multiple fields at onceawait chrome.fillForm([
{ uid: emailInputUid, value: 'test@example.com' },
{ uid: passwordInputUid, value: 'password123' },
{ uid: nameInputUid, value: 'John Doe' },
]);
// Hover over elementawait chrome.hover(buttonUid);
// Press keyboard shortcutsawait chrome.pressKey('Enter');
await chrome.pressKey('Control+C');
// Drag and dropawait chrome.drag(sourceUid, targetUid);
// Handle browser dialogsawait chrome.handleDialog('accept');
await chrome.handleDialog('dismiss');
Debugging & Inspection
// Get accessibility tree (best for finding elements)const snapshot = await chrome.takeSnapshot();
// Take visual screenshotconst screenshot = await chrome.takeScreenshot();
// List all console messagesconst messages = await chrome.listConsoleMessages();
// Get messages by levelconst errors = await chrome.listConsoleMessages('error');
const warnings = await chrome.listConsoleMessages('warning');
// Get specific message detailsconst message = await chrome.getConsoleMessage(messageId);
// Evaluate JavaScript in page contextconst result = await chrome.evaluateScript('document.title');
const userInfo = await chrome.evaluateScript(`
JSON.parse(localStorage.getItem('user'))
`);
// List network requestsconst requests = await chrome.listNetworkRequests();
// Get failed requestsconst failedRequests = requests.filter(req =>
req.status >= 400 || req.status === 0
);
// Get specific request detailsconst requestDetails = await chrome.getNetworkRequest(requestId);
Always prefer snapshot over screenshot for finding elements:
// 1. Get current page structureconst snapshot = await chrome.takeSnapshot();
// 2. Find the target element by its uidconst element = snapshot.elements.find(el => el.text === 'Continue');
// 3. Use the uid for interactionawait chrome.click(element.uid);
Pattern B: Troubleshooting Errors
When a page is failing, check both console and network:
# Run Playwright tests
npx playwright test# Run tests with UI (helps debugging)
npx playwright test --ui
# Run tests in headed mode (watch browser)
npx playwright test --headed
# Debug specific test
npx playwright test tests/login.spec.ts --debug
# Generate codegen from browser actions
npx playwright codegen https://example.com
Testing Checklist
Functionality
All user flows work end-to-end
Form validation tested for success and failure cases