元素定位

Posted on 2018-02-26 14:30  moisiet  阅读(110)  评论(0)    收藏  举报

网页前端定位的方法有:css选择器、id、name、xpath等方法,本文引用其他文章做个总结。

一、css选择器:

1、css选择器笔记-阮一峰

主要的选择器:

选择器 示例 备注
class .classname  
id\name #idname\#name  
后代 a b c 中间以空格分开
直接后代 a>b>c 中间以>分开
属性 a[attr=value]  
多属性匹配 a[a1=v1][a2=v2]  
还要众多的伪选择器不一一详述    

 

 

 

 

 

 

 

 

 

二、xpath方法:

学习总结-元素定位