Interrupt a stalled Page Load to do a Refresh on IE Page.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Interrupt a stalled Page Load to do a Refresh on IE Page.

Post by MGuyM » Wed Jul 16, 2008 8:04 pm

I've run into a bit of a problem with a Script that I'm running. I have the following code to load a web page:

Code: Select all

LibFunc>hIE,Navigate,r,%IE[0]%,http://www.microsoft.com
LibFunc>hIE,WaitIE,r,%IE[0]%
The problem I am running into is that the second line is waiting for the page to load completely before it continues. What I would like to do is to do a "Refresh" of the page if it doesn't load in XX amount of time (say 5 seconds).

I haven't been able to figure out a way to do this and I recall reading that the IEAUTO.DLL has a Refresh Function and was wondering if it might be possible to get a small enhancement to the "WAITIE" Function in that if the page doesn't load in XX seconds (which might be another option on the WAITIE Line), that it would automatically do a REFRESH Function and continue to wait.

In my particular application, the Refresh is all that is needed as I can watch my script run and when I see it stalled waiting for the page to load, I just hit the Refresh Button on the Toolbar and then my script continues.

I would appreciate anyones help on how I might be able to program around this and maybe Marcus could put an update in the WebRecorder WaitIE function to automatically do a Refresh???

Thanks!

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Post by evangelmike » Sat Jul 19, 2008 5:10 am

You might try:

[code]
Let>WW_TIMEOUT=5
LibFunc>hIE,Navigate,r,%IE[0]%,http://www.microsoft.com
Label>TryAgain
WaitWindowOpen>Microsoft Corporation - Windows Internet Explorer
// WWO Times out after 5 secs. If it Times out, check WW_RESULT.
// If set to FALSE, refresh page.

If>WW_RESULT=FALSE
GoSub>RefreshSEDI
Goto>TryAgain
Endif
// Continue normally



SRT>RefreshSEDI
Label>RedoF5
//Press F5 to refresh page
Wait>1
Press F5
Wait>0.3
// Wait for Refresh Warning Window:
WaitWindowOpen>Windows Internet Explorer
Wait>0.2
If>WW_RESULT=FALSE,RedoF5
Label>RefreshAgain
SetFocus>Windows Internet Explorer
// Try long Wait before hit Enter
Wait>2
// Retry to refresh
Press Enter
// May take long time to refresh page; Wait 2 secs
Wait>2
IfWindowOpen>Windows Internet Explorer,RefreshAgain
End>RefreshSEDI
[/code]
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Mon Jul 21, 2008 9:38 pm

The problem that I see with what you suggest is that your assuming that the Window Title Bar will say "Microsoft Corporation". I just used Microsoft as my sample site. The Page I am trying to view is actually dynamic and changes each time you hit the F5 Key and I continue to reload the page to get different information and then I'm extracting the information from the page.

Thanks for the suggestion.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jul 21, 2008 10:34 pm

I could be wrong but in my experience "Windows Internet Explorer" is part of every Internet Explorer window name. So it seems to me you could use "Windows Internet Explorer*" (be sure to include the asterisk) as the name of the window in all of the WaitwindowOpen> lines. As long as you only have one instance of Internet Explorer running WaitwindowOpen> should work properly.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Jul 21, 2008 10:47 pm

That's generally a good assumption but it is possible (via the registry) to change the IE default title, some companies do it to customize the browser, see my demo:

Image

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Jul 22, 2008 4:19 am

Hmmmm.

Then use the window's handle, that shouldn't change.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jul 28, 2008 11:46 am

A timeout for WaitIE is on the wish list. In the mean time my preferred solution would be to use image recognition. Use WaitScreenImage with a timeout. Use it to wait for a part of the resulting page.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Tue Jul 29, 2008 12:06 am

Thank You Marcus for putting this on the Wish List.

The Page is dynamically changing, so it's difficult to program an Image Recognition to it since what I might program today, could be gone tomorrow.

Thank You Again!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jul 29, 2008 7:25 am

MGuyM wrote:The Page is dynamically changing, so it's difficult to program an Image Recognition to it since what I might program today, could be gone tomorrow.
You could use WaitScreenImage to wait for "Done" to appear in the status bar. With a timeout. That is constant.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Thu Jul 31, 2008 4:34 pm

Will that even apply if I'm hiding IE?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jul 31, 2008 4:48 pm

No, won't work if IE is hidden. WaitScreenImage can only see what is visible.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Fri Aug 01, 2008 5:02 pm

When IE is hidden, does MS still wait for the Pages to load completely? I guess with IE hidden, the Timeout feature becomes more beneficial :)

Thanks!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 01, 2008 5:16 pm

MGuyM wrote:When IE is hidden, does MS still wait for the Pages to load completely? I guess with IE hidden, the Timeout feature becomes more beneficial :)

Thanks!
Yes. All the IEAuto.DLL functions work the same whether IE is hidden or not.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Sat Aug 02, 2008 1:24 am

With that in mind, I'm really wanting this feature added as soon as possible :)

Thanks!

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sat Aug 02, 2008 2:27 am

Hi MGuyM,

I'd suggest adding a Poll here to your message to drum up support however, since its already on the Wish List and since this enhancement (to IEAuto.DLL) makes so much sense, I have a feeling Marcus doesn't need any convincing.

Sidenote: The HTTPRequest> command is already covered... here's a Help file out-take:
  • By default there is no timeout for the HTTPRequest command and requests will wait indefinitely if the server fails to respond. To change this set the HTTP_TIMEOUT value to the number of seconds to wait.
Thanks for posting this MGuyM and thanks Marcus for the never-ending improvements...
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts