mywebshortcuts / mywebshortcuts

The Browser Extension to create Custom Keyboard Shortcuts on the web 🌎💻
https://mywebshortcuts.xyz
MIT License
60 stars 12 forks source link

[Enhancement] Find a more efficient way to select elements #61

Open prakhartiwari0 opened 11 months ago

prakhartiwari0 commented 11 months ago

Currently, we're using the finder npm package to generate a CSS selector of the selected element. But this method is failing to work in a lot of cases. Maybe we can either tweak its arguments and provide some additional options for users to select elements. Or we can use some different methods to store the selected elements.

I'm currently exploring XPath, let's see if I can get something from there.

The Tab mode feature will help us a lot in selecting the right elements.

Some resources and tools I have found to research on this

prakhartiwari0 commented 8 months ago

I found an interesting project during my search, it's Automa, an open-source browser extension to automate tasks. It has many features but the one I'm currently focused on is its element selector. It gives an option to select an element and click on it as it's an important feature in automating browser tasks. I got curious to know if it works on websites where My Web Shortcut's element selector isn't working, and surprisingly, it works!

prakhartiwari0 commented 6 months ago

Oh well I am an idiot. Turns out Automa is using the same library that I am using to find the CSS Selector. Check this findSelector.js file out. Sizzle JS is doing something else and I am unable to understand clearly what it does.