Selenium IDE CSS element selector
Resource recommendations:
Video resources: series of videos related to software testing
Community Resources: automated Test Communication Group
Css selector
Find through node attributes
.class selects all elements of the class= "intro".
# id Select all elements of id= "firstname".
* Select all elements.
Find through node relationship
Element element descendant selector
Element > element child element selector
Element+element sibling selector
Element1~element2 p~ul, select the front
Each element of the element.
Find through node attributes
[attribute] [target] Select all elements with the target attribute.
[attribute=value] [target=_blank] Select all elements of target= "_ blank".
[attribute~=value] [title~=flower] Select all elements where the title attribute contains the word "flower".
[attribute | = value] [lang | = en] Select all elements whose lang attribute value begins with "en".
[attribute ^ = value] a [src ^ = "https"] Select each element whose src attribute value begins with "https".
[attribute$=value] a [src$= ".pdf"] selects all elements whose src attribute ends with ".pdf".
[attribute*=value] a [src*= "abc"] selects each element whose src attribute contains a "abc" substring.
Pseudo class selector
: link a:link selects all links.
: checked input:checked selects each selected element.
First-child p:first-child selects each of the first child elements that belong to the parent element
element.
Last-child p:last-child selects each of the last child elements that belong to its parent element
element.
First-of-type p:first-of-type selects the first one that belongs to its parent element
Each of the elements
element.
: last-of-type p:last-of-type selects the last that belongs to its parent element
Each of the elements
element.
: only-of-type p:only-of-type selects the only one that belongs to its parent element
Each of the elements
element.
Only-child p:only-child selects each of the only child elements that belong to its parent element
element.
: nth-child (n) p:nth-child (2) selects each of the second child elements that belong to its parent element
element.
: nth-last-child (n) p:nth-last-child (2) same as above, counting from the last child element.
: nth-of-type (n) p:nth-of-type (2) Select the second one belonging to its parent element
Each of
element.
: nth-last-of-type (n) p:nth-last-of-type (2) is the same as above, but counting starts with the last child element.
: all elements of input
: text all elements of type= "text"
: password all elements of type= "password"
: radio all elements of type= "radio"
: checkbox all elements of type= "checkbox"
: submit all elements of type= "submit"
: reset all elements of type= "reset"
: button all elements of type= "button"
: image all elements of type= "image"
: file all elements of type= "file"