如何为同一页面上的广告链接数量编写 X-path 并且在 HTML 代码中没有唯一的 id 和唯一的名称来区分,我写在下面,请为“点击”广告提供唯一值并在新窗口中打开广告,由于所有广告都有 class="ad" 并且值是动态的,请帮帮我,因为我想一一打开所有广告并验证其中的数据我只展开了两个广告,所有其他广告都折叠了
例子:
<div class="result hlisting">
<div class="result hlisting">
<div class="info">
<h2>
#11856006:
<a class="ad" href="http://www.performancecars.ca/index.php/details/11856006/2009-Toyota-Camry.html">2009 Toyota Camry</a>
</h2>
<span class="price"> 14.584 CAD </span>
<p class="address">
<b>Date: </b>
2012-10-09 13:29:01
</p>
</div>
<p class="description">
<p class="data">
<div class="clear"> </div>
<hr>
</div>
<div class="result hlisting">
<div class="result hlisting">
<div class="info">
<h2>
#11930827:
<a class="ad" href="http://www.performancecars.ca/index.php/details/11930827/2010-Mazda-MAZDA3.html">2010 Mazda MAZDA3 GS ONE OWNER, SU.</a>
</h2>
<span class="price"> 14.200 CAD </span>
<p class="address">
</div>
<p class="description">
<p class="data">
<div class="clear"> </div>
<hr>
</div>
<div class="result hlisting">
<div class="result hlisting">