Started with Angular and Protractor.
It just feels wrong to write some heavy css selectors which will break instant when you change something. Using ID's would make testing way easier.
I'm not using any id attribute for styling yet. Are there any drawbacks using ids for testing I haven't considered?
The general rule is to use IDs whenever possible assuming they are unique across the DOM and not dynamically generated. Quoting Jim Holmes:
Also, in general try to use the "data-oriented" approach:
by.model
,by.binding
,by.repeater
locators, or if you rely on class names, choose them wisely: do not use layout-oriented classes like.col-xs-4
or.container-fluid
.See also these related topics: