views:

228

answers:

8

I was wondering if there is such an addon in firefox where you can test out css paths to check if they are finding the correct element? I was looking for something similar to xpather for xpath locations.

+3  A: 

Try firebug. http://getfirebug.com/

ruibm
+5  A: 

Yes you can go for the FireBug....

alt text

Sarfraz
Firebug FTW!!!!
runrunraygun
Is there a way to navigate to an element using a CSS selector in Firebug? It's not quite the same thing as just viewing the element's position in the DOM.
Renesis
@Renesis: yes it is possible, see its documentation. thanks
Sarfraz
For those who don't want to have to search for it, I found the relevant section here: http://getfirebug.com/wiki/index.php/Command_Line_API#.24.24.28selector.29. Use `$$('selector')` in the Firebug console.
Renesis
+3  A: 

Not sure if this helps. Try Firebug. Allows you to select an item, and see what it's css path is, as well as the css currently being applied.

Can do some experimentation in the html/css right in the browser.

Mikezx6r
+1  A: 

jQuery


With jQuery you could easily add a large red border to an element using the selector.

$(document).ready(function(){

  $('#your-css-selector').css('border', '5px solid red');

});
Jon Winstanley
+9  A: 

FireFinder does exactly what you are looking for. You can evaluate either CSS, or XPath expressions, it will list the matching elements, and also draw a red border around them.

FireFinder

WishCow
+1 for a complete, correct answer, and a nice UI to go along with it.
Renesis
This is exactly what I was looking for and very easy to use! Thank you!
A: 

The 'Find' button in Selenium IDE is very useful for this. It uses the same method to locate elements as your tests will, so can be used to locate elements using any of the supported strategies.

Dave Hunt
A: 

Firebug (https://addons.mozilla.org/en-US/firefox/addon/1843) or Web Developer Toolbar (https://addons.mozilla.org/en-US/firefox/addon/60). Both show path.

Tom
A: 

Firefinder is great for testing selectors. However, if also you want to obtain the CSS selector for an element try SelectorGadget.

nacmartin