Jump to content

Relaunching IE and navigate to a URL when loading takes more time


Recommended Posts

Hello everyone,

When I launch a URL and the webpage takes more time to load (say more than 1 minute), I want the URL to be relaunched.

I used _IELoadWait(). But the control doesn't get pass through the _IELoadWait() command, since the webpage takes more time to load.

I searched some of the older posts related to this topic. But I couldn't work them out.

Please guide me.

Link to comment
Share on other sites

Sure Danp2.

Global $oIE_SL_CA = _IECreate()
_IENavigate($oIE_SL_CA, "---URL-HERE---")
_IELoadWait($oIE_SL_CA)

The IE window is just passive for long time. But the webpage was not loaded.

I tried the following code after the _IELoadWait()

Local $sStatusMessage = _IEPropertyGet($oIE_SL_CA, "statustext")
MsgBox(0, "Information", $sStatusMessage)

The status text was not displayed since the control didn't get past _IELoadWait().

Link to comment
Share on other sites

I tried the following code with time out value as 10 seconds. But the message box I have coded below was displayed only after several seconds when the webpage was completely loaded.

While 1

      _IELoadWait($oIE_SL_CA, 0, 10000) ; Timeout Value in milliseconds

      MsgBox(0, "Information", "ReLaunching")

      _IENavigate($oIE_SL_CA, "---URL-HERE---")

      If Not @error Then ExitLoop

   WEnd

 

Link to comment
Share on other sites

I think the timeout was not considered.

Only after nearly one full minute, the webpage was loaded and the message box was populated.

Is there a way to consider the timeout value alone and relaunch the url when the timeout has occurred?

Link to comment
Share on other sites

Try this please

 

#include <IE.au3>

$oIE_SL_CA = _IECreate()

While 1

    _IENavigate($oIE_SL_CA, "https://google.com", 0) ; change the url

    _IELoadWait($oIE_SL_CA, 0, 10000) ; Timeout Value in milliseconds
    If Not @error Then ExitLoop

    MsgBox(0, "Information", "ReLaunching")

WEnd

If the Timeout is reached the _IELoadWait Function returns an error.

The script only exits the loop if there is no error, aka the site loading successfully.

Edited by Floops
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...