0

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.

Similar to copyXpath

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

Alexander Pavlov
  • 31,598
  • 5
  • 67
  • 93
chaosguru
  • 1,933
  • 4
  • 30
  • 44

3 Answers3

0

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

Alexander Pavlov
  • 31,598
  • 5
  • 67
  • 93
  • I have updated the question with image . hope it will be more clear. – chaosguru Jun 25 '13 at 09:25
  • 1
    Ah, now I see what you mean. Well, unlike XPath, there's no unique CSS selector for an element in the general case. If you have a specific suggestion for how this should work, feel free to file a feature request at http://crbug.com/new! – Alexander Pavlov Jun 25 '13 at 09:35
  • Hi @Alexander : thank you for your reply. :-) I will do the same – chaosguru Jun 25 '13 at 09:40
0

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

chaosguru
  • 1,933
  • 4
  • 30
  • 44
0

Atlast the CopyCssPath is implemented by Chrome
CopyCSSPath from Chromium

chaosguru
  • 1,933
  • 4
  • 30
  • 44