I want to create xpath which must contain word "Asia"
// DIV [@ ID = '目的地loadLevel0'] / DIV / UL / LI / DIV / DIV /跨度
*为亚洲
// DIV [@ ID = '目的地loadLevel0'] / DIV / UL /利[2] / DIV / DIV /跨越
*适用于欧洲
// DIV [@ ID = '目的地loadLevel0'] / DIV / UL /锂[3] / DIV / DIV /跨度
*为美国
//<div class="col-md-3 level-column column-viewport" id="destination-loadLevel0">
<div class="row">
<ul>
<li class="col-md-3 col-hotspot unselectable-text" data-parent-group-id="" data-groupid="2244604" data-name="Asia;|03|00|00|">
<div class="tile-container">
<div class="image-label" data-toggle="tooltip" data-container="body" data-placement="top" title="" data-original-title="Asia">
<span class="title ellipsis">Asia</span>
<span class="icon icon-angle-right"></span>
</div>
答案 0 :(得分:1)
//*[contains(text(),'Asia')] | //@*[contains(.,'Asia')]/parent::*
返回其文本包含“Asia”或其属性值包含“Asia”
的所有元素输出:
<li class="col-md-3 col-hotspot unselectable-text" data-parent-group-id="" data-groupid="2244604" data-name="Asia;|03|00|00|" />
<div class="image-label" data-toggle="tooltip" data-container="body" data-placement="top" title="" data-original-title="Asia" />
<span class="title ellipsis">Asia</span>