Jump to content

Recommended Posts

Posted

Hi,

I would like to understand how to best deal with timeouts when loading URL's via IE.au3. If you accept the default setting to 'Wait for page to load to complete' then occassionally when a Web page doesn't load as it should your script just waits forever.

To get around this I have changed $f_wait setting and used Sleep commands around the _IECreate, which means that the script waits a certain amount of time before continuing. This is not ideal either, because often the scripts waits, for the Sleep period when the Web page has already loaded fully.

Ideally what I would like to be able to do is 'Wait for page to load to complete' or a specified timeout period, eg. if the page doesn't load within 30 seconds then continue processing the script anyway. Can this be done?

Thanks

VW

  • Moderators
Posted

Look at _IELoadWaitTimeout() in the help file. It was designed to do exactly what you are asking.

@John - I commend you for trying to help, but please try to research before posting an answer. This is the second topic now that you have posted without doing so.

Thanks,

Bob

Posted

Look at _IELoadWaitTimeout() in the help file. It was designed to do exactly what you are asking.

You're right, that works much better, the default timeout must be a high value.

Cheers,

VW

Posted

Default value is 5 minutes.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted

Default value is 5 minutes.

Every once in a while IE doesn't honour the LoadWaitTimeout value, you see a message on the Autoit console and IE just keeps trying to load something on the page.

It's quite possibly an IE issue rather than with the UDF, because even if you hit the stop button on the browser, the IE instance just keeps trying to do whatever it's trying to do.

Have you seen this happen at all?

Posted

Every once in a while IE doesn't honour the LoadWaitTimeout value, you see a message on the Autoit console and IE just keeps trying to load something on the page.

It's quite possibly an IE issue rather than with the UDF, because even if you hit the stop button on the browser, the IE instance just keeps trying to do whatever it's trying to do.

Have you seen this happen at all?

Please understand that the timeout is how long the script will sit around waiting for the page load to complete - if the timeout value is exceeded, it doesn't do anything to the browser, it just returns an error and gives control back to your script.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted

Please understand that the timeout is how long the script will sit around waiting for the page load to complete - if the timeout value is exceeded, it doesn't do anything to the browser, it just returns an error and gives control back to your script.

I would like to write a function to make all my IE calls, so that I can include logic to handle timeouts. Generally the solution to a timeout is simply to retry the command, because if the code is tested, the timeout is either because the Internet connection has died or because the instance of IE has experienced a glitch (and generally the later).

To make a general-purpose function ideally I would pass the IE command as a variable to the function, but I then need a way of executing the command string in the variable

IE_Command("$o_IE = _IECreate("http://www.autoitscript.com")")

Func IE_Command($Command)
    $IE_ErrorCount = 0
;   Somehow process "Command" here  
    If @error <> 0 Then
;   Some error has occurred     
        $IE_ErrorCount = $IE_ErrorCount + 1
        While $IE_ErrorCount < 2
;           Retry Command here
                If @error <> 0 Then
                 $IE_ErrorCount = $IE_ErrorCount + 1
                EndIf
        WEnd
        MsgBox(0,"Error", "Executing command: " & $Command)
;       Maybe the Internet is down, or this command needs testing       
        Exit
    EndIf
EndFunc

Is this idea workable and if so, is there an easy way of executing the contents of $Command variable?

Or is there a better way of doing this?

Thanks

VW

Posted

Actually I have since realised this is straightforward.

I can read the $Command string and identify the command and extract the argument for the command, and then execute the command with the argument.

VW

Posted

Please understand that the timeout is how long the script will sit around waiting for the page load to complete - if the timeout value is exceeded, it doesn't do anything to the browser, it just returns an error and gives control back to your script.

Hi Dale,

Intermittently I believe I am seeing situations where the timeout by the instance of IE appears to cause the IE.UDF to "hang".

I would like to be able to log these situations when they occur. Here is an extract from the ErrorHandler log

--> COM Error Encountered 
----> $ErrorScriptline = 434
----> $ErrorNumberHex = 80010105
----> $ErrorNumber = -2147417851
----> $ErrorWinDescription = The server threw an exception.
----> $ErrorDescription = 
----> $ErrorSource = 
----> $ErrorHelpFile = 
----> $ErrorHelpContext = 
----> $ErrorLastDllError = 0

You will note that a number of the fields are blank. Is it possible to log the URL and the IE.UDF command that was being executed at the time that an error occurs? So that I can make the Error Log more useful.

Thanks

VW

Posted

You'll just need to litter your code with debug statements.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted

The topic is dealing with IE timeouts, so along those lines

AutoIt Help File says:

IELoadWait

Wait for a browser page load to complete before returning.

WinWaitActive

Pauses execution of the script until the requested window is active.

If I'm waiting to send a login & password, is "IELoadWait" the perfered

function to use?

vim

Posted

The topic is dealing with IE timeouts, so along those lines

AutoIt Help File says:

IELoadWait

Wait for a browser page load to complete before returning.

WinWaitActive

Pauses execution of the script until the requested window is active.

If I'm waiting to send a login & password, is "IELoadWait" the perfered

function to use?

vim

A browser window can be active (have focus) regardless of what is happening inside the browser. So, yes, if you are waiting for a page load to complete so that you can enter something into it, _IELoadWait is what you want.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...