Trouble fetching date from ImportXML. Need options

陌路散爱 提交于 2019-12-11 22:05:15

问题


Using Google Sheets. I'm trying to fetch the ETA date on this page: https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR181027806#

In the future, I will be using different blno's, so the ETA will change based on the blno (bill of lading number). In the future, blno will come from a column.

I used the standard web-page inspection methods to determine that the xpath for the element that I want is the following: //*[@id="ext-gen156"]

This is the XPath for the ETA date, which in this case is, 12/4/2018, when you visit the page.

I populated E4 with: https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR181027806#

And I populated E5 with: //*[@id="ext-gen156"]

Then formula "=importxml(E4,E5)" gives result "N/A" (on F4).

If I change E4 to https://en.wikipedia.org/wiki/List_of_T_postal_codes_of_Canada

and E5 to //*[@id="mw-content-text"]/div/table[1]/tbody/tr[1]/td[6]/span/a[1]

it works... it gets a different piece of information from a different website.

I suspect that the reason I am having problem for the first scenario described above is that it is not a static page. Maybe it only works for static pages.

I tried to understand what XPath means, but it is also very confusing. If someone were to point me to a good explanation of this, that would also be valuable. For example, the following document says that you should use "." to select the current node. What does current mean in the context in which I am trying to use XPath? Didn't seem to make sense.

https://www.w3schools.com/xml/xpath_syntax.asp

Any guidance in strategy would be appreciated. I could be going about it all wrong. I contacted Hapag-Lyod also, to see if they have an RSS feed, although I am new to that as well.

So, for the experts out there that have done something like this, what would be possible directions to tackle this project?

I'm working backwards. I have a goal, but I don't know all the technology. My background is more of client apps, so I am having research trouble when it comes to web applications. Hope I was detailed enough, but if not, let me know how to improve the question and I will be happy to do so.


回答1:


We are starting to play with a tool called AutoIt. This is going to be the right tool for this problem.



来源:https://stackoverflow.com/questions/54429062/trouble-fetching-date-from-importxml-need-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!