Selenium IDE DOM element selection locator
Resource recommendations:
Video resources: series of videos related to software testing
Community Resources: automated Test Communication Group
DOM locator
DOM (Document ObjectModel) represents the entire HTML document and can be accessed by using javascript, through which the javascript result is evaluated as an element in a page. The code example is as follows:
Dom=document.getElementById ('loginForm') (3)
Dom=document.forms ['loginForm'] (3)
Dom=document.forms [0] (3)
Document.forms [0] .username (4)
Document.forms [0] .elements ['username'] (4)
Document.forms [0] .elements [0] (4)
Document.forms [0] .elements [3] (7)
Note: since only dom locators use positioning expressions that start with "document", the prefix "dom=" of positioning expressions can be ignored.
More common ways to find page elements are as follows:
GetElementById () returns a reference to the first object that owns the specified id.
GetElementsByName () returns a collection of objects with the specified name.
GetElementsByTagName () returns a collection of objects with the specified tag signature.
GetElementsByClassName returns a collection of objects with the specified Class.
ChildNodes returns all child nodes (including text nodes)
Children returns all html child elements
FirstChild returns the first child node of the current page element (including the text node)
FirstElementChild returns the first child of the current page element
LastChild / lastElementChild
NextSibling returns the next sister node of the current node
NextElementSibling returns the next sister element node of the current node
PreviousSibling / previousElementSibling
ParentElement / parentNode
QuerySelector supports css selector positioning elements.