UrlDownloadToFile doesn't download the whole webpage

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Benny-D
Posts: 302
Joined: 12 Mar 2014, 10:09

UrlDownloadToFile doesn't download the whole webpage

03 Aug 2021, 23:35

Here is the URL of the page I am trying to download: https://web1.fyh.mohw.gov.tw/oinetregweb/OINetReg.Reg/Sub_RegTable.aspx

The page consists of only one table and looks like this:Image

I use this script (taken from UrlDownloadToFile command documentation) to download that page:

Code: Select all

whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "https://web1.fyh.mohw.gov.tw/oinetregweb/OINetReg.Reg/Sub_RegTable.aspx", true)
whr.Send()
; Using 'true' above and the call below allows the script to remain responsive.
whr.WaitForResponse()
version := whr.ResponseText
MsgBox % version
clipboard := version
The problem is what I receive as a result of downloading doesn't seem to contain the whole thing. For example, I don't get the Chinese names that can be seen in that table:
Image

What's surprising is that when I try to inspect those elements using Google Chrome (by pressing F12 button), I still can see those names in the source page:
Image

So it looks like the Chrome browser can see something that AHK UrlDownloadToFile command doesn't. How can I make AHK also see and, therefore, also download those names in the page source?
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: UrlDownloadToFile doesn't download the whole webpage

03 Aug 2021, 23:58

probably because the data is loaded dynamically, try using IE com to confirm
User avatar
Benny-D
Posts: 302
Joined: 12 Mar 2014, 10:09

Re: UrlDownloadToFile doesn't download the whole webpage

04 Aug 2021, 00:03

AHKStudent wrote:
03 Aug 2021, 23:58
try using IE com to confirm
- Can you, please, give me a clue on where to find and how to use IE com? I don't know anything about it.
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: UrlDownloadToFile doesn't download the whole webpage

04 Aug 2021, 00:11

Benny-D wrote:
04 Aug 2021, 00:03
AHKStudent wrote:
03 Aug 2021, 23:58
try using IE com to confirm
- Can you, please, give me a clue on where to find and how to use IE com? I don't know anything about it.
look in your clipboard after u run this to see if u have the data

Code: Select all

pwb := ComObjCreate("InternetExplorer.Application")
pwb.Visible := false ; make true if you wanna see the ie window
pwb.Navigate("https://web1.fyh.mohw.gov.tw/oinetregweb/OINetReg.Reg/Sub_RegTable.aspx")
	while pwb.busy or pwb.ReadyState != 4 
		Sleep, 130
Clipboard := pwb.document.documentElement.innerHTML
pwb.quit()
User avatar
Benny-D
Posts: 302
Joined: 12 Mar 2014, 10:09

Re: UrlDownloadToFile doesn't download the whole webpage

04 Aug 2021, 00:17

No, I can't see those name using this script either. :(

It's surprising to me that neither IE come, not AHK can't fully get the dynamically-loaded pages, while Chrome can.
User avatar
Benny-D
Posts: 302
Joined: 12 Mar 2014, 10:09

Re: UrlDownloadToFile doesn't download the whole webpage

04 Aug 2021, 00:25

I just discovered that when I try to look up that page in IE browser by entering the same URL, IE shows an empty page containing no table at all (there is only a header image)! Why could it be so? Does it mean that IE simply can't show some of dynamic pages?
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: UrlDownloadToFile doesn't download the whole webpage

04 Aug 2021, 00:27

It means that site is not IE compatible

try chrome.ahk

I am getting a blank page in chrome

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, exodus_cl, Google [Bot], ratyrat, Sniperman and 368 guests