在iMacro for Firefox中选择src属性的XPath不起作用?

时间:2016-05-11 08:51:17

标签: html xml xpath

<div class="product-thumbnails" data-show="5">
  <div href="http://cdn.palmgren.com/images/products/9661051.jpg" 
       class="item-image" title="">
    <img width="100" height="128" 
         src="http://cdn.palmgren.com/images/thumbnails/9661051.jpg" alt=""/>
  </div>
  <div href="http://cdn.palmgren.com/images/products/9661101_death_stop.jpg"
       class="item-image" title="">
    <img width="100" height="128" src="" alt=""/>
  </div>
</div>

我已经编写了以下代码来提取src,即http://cdn.palmgren.com/images/thumbnails/9661051.jpg,但它无效。请帮我纠正代码。

TAG XPATH="//div[@class="product-thumbnails"]/div[1]/img" EXTRACT=src

1 个答案:

答案 0 :(得分:0)

此XPath(在原始内容中添加/@src

//div[@class="product-thumbnails"]/div[1]/img/@src

将选择

http://cdn.palmgren.com/images/thumbnails/9661051.jpg

按要求。