Ritesh Saini

How to Extract Precise CSS and XPath Selectors with Voilà AI

Extract Precise CSS and XPath Selectors with Voilà AI

I use Voilà AI on a daily basis for most of my tasks like writing replies to emails, summarizing long texts, understanding complex topics, learning new concepts, fixing grammar and writing mistakes, and more.

Recently I started using ZeroWork for creating automations. Just like any other automation tool, ZeroWork also relies on selectors to perform the actions and I was tired of manually crafting the CSS and XPath selectors that actually work.

I tried various extensions that specialize in this task like SelectorsHub and SelectorGadget and they work well. But the thing is, sometimes they give you something that doesn't work. They are good tools, but they lack intelligence.

That's when I decided to use Voilà AI for this task as well.

In this tutorial, I'll walk you through how I use the incredible Voilà AI browser extension to extract highly relevant and targeted selectors with just a few clicks.

Steps to Extract CSS and XPath Selectors with Voilà AI

  • Click on the Voila icon in your browser, then click on the "Preferences" cog icon in the popup.
  • Navigate to the "Actions" tab and click on "Create New Action".
  • Give your action a name that resonates with you. In the "Prompt" section, paste the following prompt:
Given the following HTML code, please extract highly relevant and targeted CSS selectors and XPath expressions. Please provide the CSS selectors and XPath expressions in a clear and structured format.

HTML Code:

{CLIPBOARD}
  • Set the Conversation style to "Precise" to ensure Voila stays focused and doesn't wander off-topic.

Leave the rest of the options as default. Here's a screenshot of how my action looks:

Now that your Voila action is set up, it's time to put it to work! Follow these simple steps:

  1. Visit the website where you want to capture the selector.
  2. Right-click on the desired element and select "Inspect" to open the inspect element tool.
  3. Hover over the highlighted element in the inspect element to ensure the correct element is selected.
  4. Right-click on the element, navigate to "Copy", and select "Copy Element". You can now close the inspect element tool.
  5. Click on the Voila icon to bring up the popup, find the action you created, and simply press Enter.

Voila will automatically fetch the HTML of the element from your clipboard and work its magic, extracting the most relevant CSS and XPath selectors for you. Check the video below for a visual explanation:

Pro Tip: Experiment and Refine

Don't be afraid to experiment with different elements on the page to find the most suitable selectors for your needs. Also, if you face any issues, just ask Voilà your questions in the same chat. The more you share about your problems or requirements, the better the AI will respond.

With the Voila extension and this simple custom action, you can bid farewell to the headache of manually writing complex selectors. So go ahead, give it a try, and let me know how it works out for you. Happy selector hunting! 🙂

All of RiteshSaini.me's content is free forever for individuals. You can power this content with a coffee, by subscribing, and by sharing to your networks! Any support is welcome and hugely appreciated!
About the author
Ritesh Saini

Ritesh Saini

I'm an internet marketer and blogger from India. I started my digital journey when I was just 19 years old. I'm also the founder and sole proprietor of Happensmith.co

Hi there, I'm Ritesh 👋

I am an internet marketer and a blogger. Started my journey purely out of curiosity and my love for geeky stuff.<br/><br/>This site is where I share my journey and experiences, from solving tech problems to learning new skills.<br/><br/>Here you'll find helpful insights, easy-to-follow tutorials, detailed reviews of products or services I've personally tested, and useful resources that will keep you updated. Subscribe today!

Ritesh Saini

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Ritesh Saini.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.