Skip to content

secondsky/claude-skills / plugins/playwright/skills/playwright

playwright

Verified

Browser automation and E2E testing with Playwright. Auto-detects dev servers, writes clean test scripts. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use for cross-browser testing, visual regression, API testing, component testing in TypeScript/JavaScript and Python projects.

FileKindSize
SKILL.mdskill md14.4 KB
examples/form-test.jsscript876 B
examples/link-checker.jsscript1.8 KB
examples/responsive-test.jsscript1.1 KB
lib/helpers.jsscript13.2 KB
package.jsonmanifest1.0 KB
references/API_REFERENCE.mdmarkdown14.6 KB
run.jsscript7.1 KB

examples/link-checker.js

View on GitHub
// Example: Check for broken links on a page
const { chromium } = require('playwright');

const TARGET_URL = 'http://localhost:3000'; // Change as needed

(async () => {
  const browser = await chromium.launch({ headless: false });
  const page = await browser.newPage();

  console.log(`Checking links on: ${TARGET_URL}\n`);
  await page.goto(TARGET_URL);

  // Get all links, then filter to http(s) only
  // Note: This excludes relative links (/about), mailto:, tel:, and #anchors
  const allLinks = await page.locator('a[href]').all();
  const httpLinks = [];

  for (const link of allLinks) {
    const href = await link.getAttribute('href');
    // Filter to only http(s) and protocol-relative links
    if (href && (href.startsWith('http://') || href.startsWith('https://') || href.startsWith('//'))) {
      httpLinks.push({ locator: link, href });
    }
  }

  console.log(`Found ${httpLinks.length} external http(s) links to check\n`);

  const results = { working: 0, broken: [] };

  for (const { locator: link, href } of httpLinks) {
    try {
      const response = await page.request.head(href);
      if (response.ok()) {
        results.working++;
        console.log(`✅ ${href}`);
      } else {
        results.broken.push({ url: href, status: response.status() });
        console.log(`❌ ${href} (Status: ${response.status()})`);
      }
    } catch (e) {
      results.broken.push({ url: href, error: e.message });
      console.log(`❌ ${href} (Error: ${e.message})`);
    }
  }

  console.log(`\n\n=== RESULTS ===`);
  console.log(`✅ Working links: ${results.working}`);
  console.log(`❌ Broken links: ${results.broken.length}`);

  if (results.broken.length > 0) {
    console.log('\nBroken link details:');
    console.log(JSON.stringify(results.broken, null, 2));
  }

  await browser.close();
})();
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall