xpath同时定位嵌套和非嵌套元素
<button>aa</button>
<button>
<span>aa</span>
</button>
//*[(self::button or (self::* and parent::button)) and normalize-space(text())='aa']
xpath定位每个父元素都不包含某属性的元素
<div style="display:none;">
<p>bb</p>
</div>
<div>
<div style="display:none;">
<p>bb</p>
</div>
</div>
<div style="display:none;">
<div>
<p>bb</p>
</div>
</div>
<div>
<div>
<p>bb</p>
</div>
</div>
//p[not(ancestor::*[contains(@style,'none')])]
xpath两种定位“或”连接
(//button)|(//body/p)