This document discusses different locator types for Selenium automation testing including ID, name, className, linkText, and more. It covers CSS locators and selectors like ID selector, class selector, descendant combinator, and attribute selectors using values, patterns, and operators. The document also discusses text locators using contains and contains not as well as pseudo-class locators like :nth, :nth-child, and :first-child.
3. CSS Locators
Faster compared to XPath in Internet Explorer due to native
support
Simple statements
CSS3 locators are not advisable as it is JQuery statements
OVERVIEW ? PAGE 3
4. General
CSS Selectors
ID Selector [#]
#id
Class Selector [.]
.class
.class.class
Descendant combinator [ ]
.class .class
Child Combinator [>]
.class > .class
.class >>> .class
Next or Adjacent Combinator [+]
.class + *
.class + * + *
General Combinator [~]
.class ~ .class
GENERAL ? PAGE 4
5. Attribute
CSS Selectors
With value
input[type="text"]
Without value
input[type]
Pattern
"[id*='site-map']" --all
"[id~='site-map']" --space sepa..
"[id^='site-map']" --starts-with
"[id$='site-map']" --ends-with
"[id|='site-map']" --hyphen
ATTRIBUTE ? PAGE 5