Chrome控制台从xpath数组中获取值

时间:2015-03-28 15:09:11

标签: html google-chrome xpath google-chrome-devtools

我正在使用Google Chrome控制台获取所有类别为attrValue的元素的数组。这就是我正在使用的:

$x('//*[@class="attrValue"]');

这是我的输出:

<td class="attrValue">Transway 1A</td>, <td class="attrValue">Northbound/Westbound</td>, <td class="attrValue">Facing West</td>

获取所有元素的数组非常有用,但我试图获取这些元素中的值数组。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:4)

获取text()

$x('//*[@class="attrValue"]/text()');