How do Selenium tests locate elements for manipulation?
Firebug is a firefox plug-in help you to point out the required HTML element which you want to validate in your web automation. You can get the element attributes like class, name, etc.
As you said locate element by id is best practice.
you can use xpath by adding fire path plug-in for verifying dynamic html elements.