Skip to main content

CSS Selector objects identification

As said in Objects Identification, the CSS Selector is simply and easy a way to identify objects in HTML (identying one or many elements) and very useful.

When selecting an object, in testing, it is needed to be specific, and for it, using css tends to lead to selectors such as span[name='cars'] rather than the XPath object identification bodydiv/spn/span/table/tr/tr/tr/td/td/td/td/span[@name='cars'].

Css selectors are based in defining the kind of element added to the definition of one or more attributes. It is also possible to define only the type of element (this tends to be inaccurate) or only the attributes (one or more). At the end of the page, some examples show the way to do it.

Formulation

Examples: