A powerful Chrome extension for extracting text and attributes from web page elements using XPath expressions. Perfect for developers, data analysts, and web scrapers.
- Right-click Extraction: Right-click any element on a webpage to automatically generate its XPath and extract associated text.
- Manual XPath Testing: Input custom XPath expressions and test them directly in the popup.
- Dual Mode Extraction: Choose between extracting text content or element attributes (returned as JSON).
- Element Highlighting: Visually highlight matching elements on the page for easy identification.
- Wildcard Support: Use
[*]in XPath to extract from multiple similar elements automatically. - Export Options: Export results as plain text, JSON array, CSV, or full JSON with metadata.
- Copy Functionality: Quickly copy XPath, text, or arrays to clipboard.
- Dark Mode: Toggle between light and dark themes for comfortable use.
- Integrated Settings: Customize default export format and more.
- Privacy-Focused: All operations are local; no data is sent externally.
- Download or clone this repository.
- Open Chrome and navigate to
chrome://extensions/. - Enable "Developer mode" in the top right.
- Click "Load unpacked" and select the
Xpathdirectory. - The extension should now be installed and visible in your toolbar.
- Right-click on any element on a webpage.
- Select "Get XPath and Extract Texts" from the context menu.
- The popup will open with the generated XPath and extracted texts.
- Click the extension icon in the toolbar to open the popup.
- Enter an XPath expression in the textarea (e.g.,
//div[@class='content']). - Select extraction mode: Text or Attributes.
- Click "Test" to evaluate the XPath and display results.
- Use "Highlight" to visually mark elements on the page.
- Copy data or export to CSV/JSON as needed.
- Use
[*]in your XPath to match any index, e.g.,//ul/li[*]/a. - The extension will attempt up to 50 variations to find matching elements.
The extension requires the following permissions:
contextMenus: For adding the right-click menu option.activeTab: To interact with the current tab.scripting: To run scripts on web pages.storage: To temporarily store XPath data between popup opens.- Host permissions for all URLs to work on any website.
Read our Privacy Policy for details on data handling.
- Chrome browser
- Clone the repository:
git clone https://github.com/HFerrahoglu/XPath-Extractor.git - Load unpacked in Chrome as described above.
manifest.json: Extension configuration.background.js: Service worker for context menus.content.js: Injected script for XPath processing.popup.html/js/css: Popup UI and logic.icons/: Extension icons.privacy.html: Privacy policy page.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name. - Commit changes:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature-name. - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this extension helpful, consider buying me a coffee ☕.
For issues or questions, open an issue on GitHub or contact [hamzacferrahoglu@gmail.com].
- Added attribute extraction mode.
- Improved UI with dark mode and collapsible settings.
- Enhanced error handling and performance.