要刮饼图数据。如何有效使用XPath?

时间:2019-03-28 19:47:23

标签: html css xpath

我想在类似https://www.opskrifter.dk/opskrift/104229-bulgur-salat的页面上抓取饼图数据

它嵌套在表格元素中

我在Screaming Frog上尝试使用的Xpath:

// * [@ id =“ piechart”] / div / div [1] / div / div / table

但是没有结果。我该怎么办?

1 个答案:

答案 0 :(得分:0)

欢迎来到SO。这是使用jquery检索数据的简单示例。

$("#piechart table  td").each(function(){console.log($(this).text());});

如果要使用xpath,则下面是xpath

//div[@id='piechart']//table//td

enter image description here