I tried to webscrape the content title of post in this website : https://www.hortidaily.com/sector/553/greenhouse/
using Google Sheets Importxml function.
All posts are written in the same format :
<a class="article" href="link1">
<img src="img1.jpg" align="default" border="0" class="indexdefault">
<h1>Titre1</h1>
<p>Texte1</p>
</a>
ImportXML function with Xpath = :
- //a[@class ='article']/@href return link1 : ok
- //a[@class ='article'][1]/img/@src return img1 : ok
- //a[@class ='article'][1]/h1 return #NA (imported content is empty) eventhough the XPath is working in chrome XPath Helper...
Although //h1[1] return the title of the first article, the problem I do not understand why //a[@class ='article'][1]/h1 doesn't work and I want to be sure the h1 I get is the h1 under the first <a class="article" href="link1">
I have tried almost everything I could imagine, do not find the issue. I need some help !
Thanking you in advance