feat: add user-configurable browser selection via .claude/playwright.local.json#27
feat: add user-configurable browser selection via .claude/playwright.local.json#27citadelgrad wants to merge 2 commits intolackeyjb:mainfrom
Conversation
…local.md This release adds support for configuring the browser used by the playwright-skill through a per-project configuration file, eliminating the hard dependency on Chrome and allowing users to use their preferred browser. ## Problem The skill previously hardcoded Chromium/Chrome as the browser, requiring users to have Chrome installed. Users with alternative browsers (Brave, Edge, Firefox) or those preferring Playwright's bundled browsers had no configuration option. The skill also didn't respect any local configuration files. ## Solution Added `.claude/playwright.local.md` configuration file support with YAML frontmatter for browser settings: ```yaml --- browser: chromium | firefox | webkit channel: chrome | msedge | chrome-beta | msedge-beta headless: true | false executablePath: /path/to/browser slowMo: 100 --- ``` ## Changes ### lib/helpers.js (+206 lines) - Added `readBrowserConfig()` - reads config from .claude/playwright.local.md - Added `findConfigFile()` - searches upward from cwd to find config - Added `parseYamlFrontmatter()` - simple YAML parser for frontmatter - Updated `launchBrowser()` to use config and support `channel`/`executablePath` ### run.js (+74 lines) - Added `launchConfiguredBrowser()` - auto-injected function for scripts - Added `getBrowserConfig()` - exposes config to scripts - Updated `installPlaywright()` to skip browser download if executablePath set - Config-aware browser installation based on user preferences ### SKILL.md (+338/-184 lines) - Added "Browser Configuration" section with full documentation - Updated all code examples to use `launchConfiguredBrowser()` instead of hardcoded `chromium.launch()` - Added troubleshooting for browser config issues - Added optional frontmatter fields per Agent Skills spec: - license: MIT - compatibility: Requires Node.js - metadata: author, version ### README.md (+98/-25 lines) - Restructured for better flow (moved "What is a Skill?" earlier) - Added comprehensive "Configuration" section with examples - Added Brave browser paths for macOS/Linux/Windows - Merged "Default Settings" into Configuration table - Added "Configurable Browser" to Features list - Updated Dependencies with Node.js version requirement ### Version bump to 4.2.0 - .claude-plugin/plugin.json - skills/playwright-skill/package.json - skills/playwright-skill/SKILL.md (metadata.version) ## Testing Verified with: - Playwright's bundled Chromium (headless) - Brave Browser via executablePath (headless) - Config file discovery from nested directories ## Breaking Changes None. Existing scripts using `chromium.launch()` continue to work. New `launchConfiguredBrowser()` is additive and recommended for new scripts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@citadelgrad this a great add, thank you! Curious why use markdown for the config file though? I think it would simplify things to use a JSON file. Then we could remove all the frontmatter parsing |
|
@lackeyjb Using frontmatter is a required part of the offical standard. And since this plugin is on the Claude Code Offical plugins list. I figured we should verify everything against the standard. |
|
The spec for frontmatter is for the SKILL.md file itself. The playwright config file that you propose doesn't need to adhere to this since it's just a config for a script ( |
Addresses review feedback - simplifies config by using JSON instead of YAML frontmatter in markdown. Removes custom frontmatter parser (~35 lines) in favor of JSON.parse().
|
This release adds support for configuring the browser used by the playwright-skill through a per-project configuration file, eliminating the hard dependency on Chrome and allowing users to use their preferred browser. ProblemThe skill previously hardcoded Chrome as the browser, requiring users to have Chrome installed. Users with alternative browsers (Brave, Edge, Firefox) or those preferring Playwright's bundled browsers had no configuration option. The skill also didn't respect any local configuration files. SolutionAdded
Changeslib/helpers.js
run.js
SKILL.md
README.md
Version bump to 4.2.0TestingVerified with:
Breaking ChangesNone. Existing scripts using |
This release adds support for configuring the browser used by the playwright-skill through a per-project configuration file, eliminating the hard dependency on Chrome and allowing users to use their preferred browser.
Problem
The skill previously hardcoded Chrome as the browser, requiring users to have Chrome installed. Users with alternative browsers (Brave, Edge, Firefox) or those preferring Playwright's bundled browsers had no configuration option. The skill also didn't respect any local configuration files.
Solution
Added
.claude/playwright.local.mdconfiguration file support with YAML frontmatter for browser settings:Changes
lib/helpers.js (+206 lines)
readBrowserConfig()- reads config from .claude/playwright.local.mdfindConfigFile()- searches upward from cwd to find configparseYamlFrontmatter()- simple YAML parser for frontmatterlaunchBrowser()to use config and supportchannel/executablePathrun.js (+74 lines)
launchConfiguredBrowser()- auto-injected function for scriptsgetBrowserConfig()- exposes config to scriptsinstallPlaywright()to skip browser download if executablePath setSKILL.md (+338/-184 lines)
launchConfiguredBrowser()instead of hardcodedchromium.launch()README.md (+98/-25 lines)
Version bump to 4.2.0
Testing
Verified with:
Breaking Changes
None. Existing scripts using
chromium.launch()continue to work. NewlaunchConfiguredBrowser()is additive and recommended for new scripts.