1

我必须学习 xpath,我尝试在谷歌电子表格中使用 importxml 函数,但它不起作用。

使用 firefox,我发现了 2 个显示 xpath 代码的插件(“firebug”和“xpath checker”)。使用萤火虫我有这个xpath:

 /html/body/div/div/div[3]/div[3]/div/div/form/h1

并使用 xpath 检查器此代码:

id('titolo1')/h1

我尝试使用此代码:

=importXML("url";"//*[@id='titolo1']/h1")
=importXML("url";"//html/body/div/div/div[3]/div[3]/div/div/form/h1")
=importXML("url";"id('titolo1')/h1")

但它不起作用,任何人都可以看到问题可能出在哪里?

4

1 回答 1

2

显示 H1 的 HTML,在一般情况下:

//*[@id='titolo1']/h1

必须工作。

其他 - 检查语法(' vs ")。其他 - 尝试更广泛地查看问题所在(谷歌电子表格有时有奇怪的行为),例如:

//*[@id='titolo1']
//form
...etc.
于 2015-11-02T17:28:54.917 回答