网页介绍
1,标签名 <input>
2,属性 <input id = 'aaa'>
3,text 内容
4,下属标签
xpath 定义
XPath 是一门在 XML 文档中查找信息的语言。XPath 用于在 XML 文档中通过元素和属性进行导航。
xpath 中有七种类型,元素,属性,文本,命名空间,处理指令,注释,根节点
节点之前的关系:
Parent(父) children(子) sibling(同胞) 先辈(Ancestor)后代(Descendant)
1索引
//div/a[1]用蒜
2,最后一个
//div/a[last()]
3,倒数第二
//div/a[last()-1]
4,通配符
contaiins[text() = '新闻']
5,选择前两个元素
/bookstore/book[position()<3]
6,选择若干路径 |
//book/title | //book/price 选取 book 元素的所有 title 和 price 元素。