UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Waiting For A Web Page To Complete Loading, Internet Explorer 8    
 
   
dflak
post Jun 13 2013, 08:54 AM
Post#1


Utter Access VIP
Posts: 6,017
Joined: 22-June 04
From: North Carolina


I have tried
CODE
While ie.busy
   DoEvents
Wend

!--c1-->
CODE
While ie.readystate <> 4
  DoEvents  'wait until IE is done loading page.
Loop

CODE
Do
  Loop Until ie.ReadyState = 4

None of which seem to work. Does anyone have a suggestion on how to get feedback from IE as to when it's done loading a page? Is there some incantation I haven't found yet?
This code does seem to work on our previous version of the dashboard which is mostly HTML. The version of the dashboard that fails is mostly javascript. I don't know if that makes a difference.
The only way I can get my code to work is with a fixed time interval. In other words, I add a 5 second delay between link clicks whether I need it or not and hope that it's enough: very wasteful and inprecise. Most of the times it works, some times it doesn't.
Go to the top of the page
 
ipisors
post Jun 13 2013, 09:15 AM
Post#2


Banned
Posts: 9,239
Joined: 21-June 07



FWIW, here is what my experience with this problem has been. If you use that code and it doesn't appear to work, then here is what's actually happening. Internet explorer actually IS done loading the page. However, the page source code may well have called other [javascript, for example] functions which aren't done doing what they're going to do yet.
had this exact problem about a year ago when I was trying to manipulate a government webpage that the client used to submit and query information. The thing about manipulating IE is that (I know it's taboo to say things like this but I firmly believe this don't come down on me too hard), to some extent it's a lost cause. Sure IE is exposed to VBA, but the reality of it is that it's really not analogous to Excel, Outlook, Powerpoint etc., where you're creating a brand new program....with IE you have to worry about the programming of the guy who created the webpage. And unfortunately you will end up dealing with hidden functions, buttons with ID #'s that appear in the source code but don't appear to be readable by VBA, etc. To the extent that simple webpages can be manipulated by VBA I accept that in my day to day work but the rest of it I've somewhat skipped over because I realized that it was too 'hit and miss' to be worth much.
Long story short. When you use that code , the best it can do is see if IE is done loading the webpage. But there could be 16 other Javascript functions that got called ... they could take 1 minute more, 3 minutes more, or 10 minutes more to finish doing what they're doing. VBA wouldn't have a clue.
(ps I also noticed this when I once had to actually use VBA to CALL one of those functions, as opposed to clicking a button. This is when I realized this because I'd call the function, then use readystate type of code...it was always wrong, and I was like WTH ?...until I realized IE is done loading, but there could be 3 other programming languages still doing their thing.....
Owouldn't feel bad about the hard coded delay, it's about what I would do too. However I've written a function that I use to display a nice "Processing, please wait.." to user. It makes all things better, as users are quite forgiving and some profressionalism is achieved if at least, the display appears intelligent.
Go to the top of the page
 
dflak
post Jun 13 2013, 09:19 AM
Post#3


Utter Access VIP
Posts: 6,017
Joined: 22-June 04
From: North Carolina


Well, the explanation is certainly reasonable, and I do believe that is exactly what is happening in this case. The good news is that the developers of this dashboard are on contract to our company. The bad news is that they probably haven't got a clue about VBA and a means of detecting when a page has "rendered." Nonetheless, I will reach out to them to see if they can help.
Go to the top of the page
 
ipisors
post Jun 13 2013, 09:21 AM
Post#4


Banned
Posts: 9,239
Joined: 21-June 07



oh that's really good, yeah. Maybe they can do something to make it more like IE is truly hosed up until such time as....
which your code can then detect.
just noticed now your comment in OP about javascript hadn't even read that far originally sorry. Yes agreed.
Go to the top of the page
 
ipisors
post Jun 13 2013, 09:22 AM
Post#5


Banned
Posts: 9,239
Joined: 21-June 07



Or maybe they could do something creative but really simple...like having their java functions create a little cookie/text file when it's done.
When you could loop until Dir()<>"" ........
Go to the top of the page
 
dflak
post Jun 13 2013, 10:50 AM
Post#6


Utter Access VIP
Posts: 6,017
Joined: 22-June 04
From: North Carolina


As I was told when I was flying, "Never fly yourself into a corner. Always give yourself a way out."
On theory, I have access to all the data I need to generate these reports in an Excel soluiton. I do need help from people to point me to where it is kept.
Also a coworker has access to a piece of testing software that looks like it could do the web crawling for us.
If neither of these solutions work, I will just hard code the seconds in there. This still beats the alternative: doing it by hand. But you know us engineers, not only does it have to work, but it has to look good while it's doing it. (Zen Engineering 101).
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    14th December 2017 - 11:43 AM