TransWikia.com

Attempting to import from a XPath, seems to always yield blank information

Stack Overflow Asked by Woahthere on November 15, 2021

Currently in my google doc, i’m working on a database for my card worth, and it seems like it doesn’t want to grab the information no matter what xpath i want to attempt.

Website i’m trying to take information available here. *This is the hyperlink i’m feeding

In the top right corner i’m attempting to grab the worth box information, here is current xpaths i’ve attempted

"//a[@id='worthBox']/h4"
"/html/body/div[4]/div[1]/div[2]/form/div[1]/div[2]/div/a/h4"
"/h4"
"/h4[0-20]"
"//a[@id='worthBox'][1]/h4"
"//div[@id='estimate-box']/a/h4"
"//div[@id='estimate-box']/a[1]/h4"

Can someone explain to me why it doesn’t seem to wanna fetch, is it even possible?

Thank you so much for your time and help!

One Answer

In the URL, the value is put using the Javascript. But IMPORTXML cannot retrieve the result after Javascript was run. IMPORTXML retrieves the HTML without running Javascript. I think that your xpath is the result after Javascript was run. By this, they cannot be used. But it seems that the value you expect can be retrieved other xpath.

Modified xpath:

//input[@id='medianHiddenField']/@value

Sample formula:

=IMPORTXML(A1,"//input[@id='medianHiddenField']/@value")
  • In this case, the URL of https://mavin.io/search?q=Lugia%20NM%209%2F111%20-PSA&bt=sold# put in the cell "A1".

Result:

enter image description here

Reference:

Answered by Tanaike on November 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP