Version: 1.0.0
Purpose: Record user clicks across pages — capture each element's XPath and a screenshot (cropped or full viewport) and export as JSON or ZIP.
- Record clicks anywhere on pages (XPaths + screenshots).
- Persist recording state across navigation and reloads.
- Toggle cropping: capture only element vs. full viewport with red outline.
- Popup UI with Start/Stop controls, recording status, item count.
- Export recorded items to:
- JSON (metadata only)
- ZIP (JSON metadata + screenshot image files)
- Simple modern UI with visual feedback and toast messages.
- Extension badge shows
RECwhen active.
xpath-recorder/
├── manifest.json
├── background.js
├── content.js
├── popup.html
├── popup.js
├── style.css
├── libs/
│ ├── jszip.min.js
│ └── FileSaver.min.js
└── icons/
├── icon16.png
├── icon48.png
├── icon128.png
└── ...
- Create a folder named
xpath-recorder-extension/. - Copy each file from this repository into that folder, preserving the paths.
- Make sure you add the third-party library files into
libs/:jszip.min.js(JSZip production build)FileSaver.min.js(FileSaver production build)
- Add simple images to
icons/(16x16, 48x48, 128x128). - Open Chrome and go to
chrome://extensions/. - Enable Developer mode (toggle in top-right).
- Click Load unpacked and select the
xpath-recorder-extensionfolder. - The extension should appear in the toolbar. Click it to open the popup.
- Open the popup and click Start Recording. Badge will show
REC, and the popup shows "Recording…". - Navigate to any website (recording persists across pages).
- Click elements you want to record — each click captures a screenshot and XPath.
- In the popup, view the number of recorded items.
- Use Download JSON to get metadata (XPaths, URL, timestamp, rect but without embedded images).
- Use Download ZIP to get a ZIP that includes
xpath-records.jsonand all screenshots (screenshot-...png). - Use Clear to delete recorded items.
- Toggle "Crop to element" in popup to control whether screenshots are cropped to element or full viewport with an outlined rectangle.
- The extension captures the visible viewport using
chrome.tabs.captureVisibleTabin the background service worker and forwards the DataURL to the content script which performs cropping or outlines using canvas. - Record items are stored in
chrome.storage.localunder keyxr_records. Recording state is underxr_recording. - Popup relies on the included
jszip.min.jsandFileSaver.min.js. Make sure to include the actual library files inlibs/. - The content script highlights the clicked element briefly for user feedback.
- This extension uses Manifest V3 (service worker background script). Some behaviors (like capture) rely on the active window/tab.
- If the popup shows count 0 after clicking elements, make sure recording is started (Start Recording).
- If screenshots are blank/partial, try capturing again or make sure you didn't block the tab's capture capabilities.
- If downloads fail, open DevTools for the popup (right-click popup → Inspect) to see console errors.
- This extension captures screenshots of web pages. Only enable recording when you want to capture content. Do not use on sensitive pages (banking, secure auth) unless you understand the implications.
- All captured data is stored locally in Chrome storage and exported files are created locally by your browser.
content.jshandles click interception, XPath computation and element highlight, and receives screenshot data from background script.background.jshandles recording state, captures viewport screenshots, and sends screenshots back to the content script.popup.html+popup.jsis the control UI and export logic (JSON/ZIP using JSZip & FileSaver).
MIT License – free to use and modify.