XPath to CSS Converter VS Code Extension This VS Code extension allows you to easily convert a selected XPath expression to its corresponding CSS selector. It simplifies web development and automation tasks by providing a quick way to translate XPaths into CSS selectors, which can be directly used in front-end testing, web scraping, or styling. Features Convert any selected XPath in your editor to a CSS selector. Automatically copies the generated CSS selector to your clipboard. Displays the CSS selector in a notification after conversion. Error handling for invalid XPaths. Installation From VS Code Marketplace (Coming Soon) This extension will soon be available on the Visual Studio Code Marketplace. Until then, you can install it manually by following the steps below. Manual Installation Clone or download this repository: bash Copy code git clone https://github.com/your-username/xpath-to-css-converter.git Navigate to the project directory: bash Copy code cd xpath-to-css-converter Install the necessary dependencies: bash Copy code npm install Open the project in VS Code: bash Copy code code . Press F5 to start the extension in the VS Code development mode. Usage Open any XML or HTML file in VS Code. Select an XPath expression in the editor. Open the Command Palette by pressing Ctrl + Shift + P. Search for and execute the command Convert XPath to CSS. The corresponding CSS selector will be automatically copied to your clipboard, and a notification will appear with the CSS selector. Example XML file: xml Copy code xpath Copy code /bookstore/book/title CSS Selector Output: css Copy code bookstore > book > title The CSS selector will be copied to your clipboard, ready for use. Commands Command Description Convert XPath to CSS Converts the selected XPath to a CSS selector and copies it to the clipboard. Development If you want to contribute or modify this extension, here are the steps to get started: Fork this repository. Clone your forked repository locally. Install dependencies using npm install. Make changes to the src/extension.js file as needed. To test, press F5 to open a new VS Code window with the extension loaded. Contributing Contributions are welcome! Please follow these steps: Fork the repository. Create a new branch for your feature or bug fix (git checkout -b feature-name). Make your changes. Test thoroughly. Submit a pull request. Please ensure that your pull request adheres to the following: Clear, concise commit messages. New features include relevant tests and documentation. The code follows the existing coding style. Issues If you encounter any bugs or have feature requests, please feel free to open an issue. License This project is licensed under the MIT License. See the LICENSE file for details. Acknowledgments The xpath-to-css library for handling the conversion logic. Contact GitHub: dkoul Email: kouldeep@gmail.com Future Enhancements Add support for XPath with namespaces. Option to handle complex or invalid XPath expressions more gracefully. Support for multiple selections or batch processing. |