CSS query generation APIs

2019-09-13 03:57发布

问题:

I have had enough search on this topic and could not find a suitable answer, finally my question is Does any one know any APIs which I can use to generate CSS query from the web page, similar to the Xpath we get it from Mozilla or chrome plugins.

attached is the image for reference.

On the similar lines of this image, I need API for CSSQuery which gives me CSS query for selected element

回答1:

Are you looking for something like document.querySelector, document.querySelectorAll (and their counterparts for Element)?



回答2:

I finally wrote my own code which generates a perfect css query :-)



回答3:

Atlast the CopyCssPath is implemented by Chrome