agentsclimarketplace

Javascript dom parser for playwright selector generation

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/javascript-dom-parser-for-playwright-selector-generation

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

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

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

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.

SKILL.md

2.5 KB, as published. Nobody here has run it

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

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.