SafePath is a Baseline-powered spin-off of HakaPath, purpose-built for the Chrome Baseline Hackathon to capture DOM elements and surface reliable XPath & CSS locators backed by Baseline data.
- Right-click capture flow that opens SafePath from the context menu.
- Four locator slots per element with hit counters and quick POM snippets.
- Instant CSS/XPath Baseline hints powered by the datasets in
public/. - Offline-first: everything runs inside the browser, nothing is sent to external services.
- Chromium browser with Manifest V3 support (Chrome, Edge, Brave).
- Node.js 18+ only if you need to rebuild the bundle or run the smoke test.
- Install dependencies (first time):
npm install. - Build the extension:
npm run build→ outputs todist/(and regenerates Baseline data). - Load in Chrome: open
chrome://extensions, enable Developer mode, press Load unpacked and pick thedist/folder. - Pin SafePath, right-click any element, choose Get SafePath, and copy the locator or generated POM snippet you need.
- Baseline dataset check:
npm run verify:baseline— confirmspublic/baseline-compat.min.jsonis in sync with the generated dataset.
manifest.json— MV3 manifest and permissions.background.js— service worker: context menu, locator generation, state sync.content_script.js— popup logic, counters, history, POM helpers.background.html— main UI (Bootstrap + FontAwesome).create_pom.js— builds the Page Object Model snippet when you copy locators.baseline-client.js/baseline-hook.js— Baseline compatibility renderer using datasets inpublic/.CSS/,JS/,IMG/,_locales/— bundled styles, scripts, icons, and translations.
npm run build— Rollup build + Baseline dataset refresh.npm run build:watch— rebuild on change while developing.npm run lint— ESLint over the generated bundle.npm run verify:baseline— ensures the Baseline dataset committed matches the regenerated output.npm run baseline:scan— audits JS APIs against Baseline targets.
- Detailed contribution workflow lives in
CONTRIBUTE.md. - Release notes and previous iterations are tracked in
CHANGELOG.md. - Questions during the hackathon: contact@hakalab.com or visit hakalab.com/hakapath.