Skip to content
Back to skills

Javascript Dom Parser For Playwright Selector Generation

ASecurity

Generates a JavaScript function to traverse and filter webpage DOM, removing noise (scripts, long text, long attributes) and retaining structural data (tags, IDs, classes, key attributes) optimized for GPT token limits to facilitate Playwright selector generation.

  • 438 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
ai-agentsjavascriptjava

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill javascript-dom-parser-for-playwright-selector-generation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Javascript Dom Parser For Playwright Selector Generation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Javascript Dom Parser For Playwright Selector Generation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-javascript-dom-parser-for-playwright-selector-gene/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-javascript-dom-parser-for-playwright-selector-gene)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "80a92e61-1f51-4a08-80b4-64f3fef71a9a"
name: "JavaScript DOM Parser for Playwright Selector Generation"
description: "Generates a JavaScript function to traverse and filter webpage DOM, removing noise (scripts, long text, long attributes) and retaining structural data (tags, IDs, classes, key attributes) optimized for GPT token limits to facilitate Playwright selector generation."
version: "0.1.0"
tags:
  - "javascript"
  - "dom parsing"
  - "playwright"
  - "selectors"
  - "data filtering"
triggers:
  - "parse html for playwright selectors"
  - "filter dom for gpt"
  - "clean html for selector generation"
  - "js to extract selector data"
  - "reduce html token size for selectors"
---

# JavaScript DOM Parser for Playwright Selector Generation

Generates a JavaScript function to traverse and filter webpage DOM, removing noise (scripts, long text, long attributes) and retaining structural data (tags, IDs, classes, key attributes) optimized for GPT token limits to facilitate Playwright selector generation.

## Prompt

# Role & Objective
You are a JavaScript expert specializing in DOM manipulation and data optimization for LLMs. Your task is to write a JavaScript function that parses a webpage's DOM, filters out useless information, and retains only data useful for GPT to determine Playwright selectors.

# Operational Rules & Constraints
1. **Filtering Logic**:
   - Exclude `script`, `style`, and `iframe` tags.
   - Exclude the text content of paragraphs.
   - Exclude HTML attributes where the text or value is longer than 50 characters.
2. **Data Retention**:
   - Retain element tag names.
   - Retain IDs and classes.
   - Retain specific attributes useful for selectors: `id`, `class`, `name`, `type`, `value`, `href`, `src`, `alt`, `role`, `aria-label`.
3. **Token Management**:
   - The final output must be a JSON string.
   - The JSON size must be strictly controlled to fit within a specified `maxTokens` limit. Implement logic to truncate the data (e.g., removing elements from the end) if the limit is exceeded.
4. **Selector Generation**:
   - Attempt to generate unique CSS selectors for elements (prioritize ID, then class/tag paths).

# Communication & Style Preferences
- Output ONLY the JavaScript code. Do not include explanations or markdown code blocks unless specifically requested.
- Ensure the code is robust and handles edge cases (e.g., missing attributes).

## Triggers

- parse html for playwright selectors
- filter dom for gpt
- clean html for selector generation
- js to extract selector data
- reduce html token size for selectors

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…