Element positioning XPath simple operation sharing
XPath simple and practical learning Selenium2
In order to learn the element positioning to start learning xpath, now record the learning experience for your reference.
What is XPath?
XPath uses path expressions to navigate through XML documents
XPath contains a standard function library
XPath is the main element in XSLT
XPath is a W3C standard
In XPath, there are seven types of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document (root) nodes. XML documents are treated as node trees. The root of a tree is called a document node or root node.
The most useful path expressions are listed below:
Expression.
Description
Nodename
Select all the children of this node.
/
Select from the root node.
/ /
Selects nodes in the document from the current node that matches the selection, regardless of their location.
.
Select the current node.
..
Select the parent node of the current node.
@
Select the attribute.
Select unknown node
XPath wildcards can be used to select unknown XML elements.
Wildcard character
Description
*
Matches any element node.
@ *
Matches any attribute node.
Node ()
Matches any type of node.
Learn by yourself:
1. Take a look at the xpath rules
2. Install Firefox plug-ins Firebug, FirePath, ViewXpath plug-ins
Comparative learning:
See XPath:.//* [@ id='su']; remember this [. / / * [@ =]]
open
Try to write it.
Install this rule to write whether other locations can also be displayed:
Hands-on practice, will be a simple positioning, this is today took a little time, learn, thank the older teachers.