I want to scrape a text within this website in google sheets with the IMPORTXML function. Through dev tools by inspecting the text in question, I get the corresponding HTML:
<li _ngcontent-udl-c4="">The outbound route is available for sale until 28/03/2020 and these are the last available dates.</li>
If I right-click > copy full XPath, I get /html/body/main/nas-fare-calendar/nas-info/div/div/ul/li[1]
. If I input that in my sheet, as in (A1 has the URL linked to above):
=IMPORTXML(A1,"/html/body/main/nas-fare-calendar/nas-info/div/div/ul/li[1]")
I get an error 'Imported content is empty.'. What gives?
I've also tried Web Scrapper extension and the way that selects the text in question is with '.list--spaceless li:nth-of-type(1)'. Any way I could use that as inspiration for an XPath? Just putting that as input for IMPORTXML doesn't work.
What is the easiest way to select for the innerHTML of that HTML snippet above? Just trying with '//li' just won't include the li above. I don't know how to include _ngcontent-udl-c4 or li that has _ngcontent-udl-c4 as a style.