Jump to content

$o_object.document.links.length ERROR


 Share

Recommended Posts

C:\Program Files\AutoIt3\Include\IE.au3 (929) : ==> The requested action with this object has failed.:
Return SetError($_IEStatus_Success, $o_object.document.links.length, $o_object.document.links)
Return SetError($_IEStatus_Success, $o_object.document^ ERROR

Is being thrown by this snippet

$oIE = _IECreate($oLink.Address , 0 , 0)
$oLinks = _IELinkGetCollection($oIE)
$DwnLink = ""


For $oLink In $oLinks

If StringInStr($oLink.innerText, "Windows 7 for x64-based Systems Service Pack 1") Then
$DwnLink = ($oLink.href)
ExitLoop
EndIf
Next

If $Dwnlink <> "" Then

_IENavigate($oIE , $DwnLink)

$iURL = _IEPropertyGet($oIE, "locationURL")

$iURL2 = stringregexpreplace($iURL , "http://www.microsoft.com/en-us/download/details" , "http://www.microsoft.com/en-us/download/confirmation")

_IENavigate($oIE , $iURL2 , 0)

sleep (10000)

winkill ("Download Security Update")

$oLinks = _IELinkGetCollection($oIE)

For $oLink In $oLinks
If StringInStr($oLink.innerText, "Start Download") Then
$DwnLink = ($oLink.href)
ExitLoop

EndIf
Next

$aDwnLink = stringsplit ($DwnLink , "/")

InetGet($DwnLink, @ScriptDir & "\KBs\" & $aDwnLink[$aDwnLink[0]] , 1 , 0)


_IEQuit ($oIE)

Endif

I am in the process of adding error checking to try and handle it, but was hoping someone more skilled could pinpoint my downfall in the meanwhile.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

I'd suggest that the error occurs with your second call to _IELinkGetCollection and that the Sleep you've entered does not insure that the document is fully loaded before trying to access it. Perhaps just an _IELoadWait prior will work, but you'll need to narrow it down further.

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

Link to comment
Share on other sites

loadwait and navigate with a wait flag hang the script, i think it has to be the prompt that is preventing it from returning a load complete.

It seems to be continuing through with these checks in place, some are probably useless, the others of no use :) But one of them is band-aiding it

Func _Downer()

$DwnLink = "a"
$DwnLink2 = "a"

$oIE = _IECreate($oLink.Address , 0 , 0)

If @ERROR = 0 Then
;~ msgbox (0, '' , $oLink.Address)
$oLinks2 = _IELinkGetCollection($oIE)
Endif

If @Error = 0 Then
For $oLink In $oLinks2
If StringInStr($oLink.innerText, "Windows 7 for x64-based Systems Service Pack 1") Then
$DwnLink = ($oLink.href)
ExitLoop
EndIf
Next
Else
msgbox (0, '' , "Error with link collection from: " & $oLink.Address)
Endif

If $DwnLink <> "a" Then

_IENavigate($oIE , $DwnLink)
If @ERROR = 0 Then
;~ _ArrayAdd ($regExLinks , $DwnLink)
$iURL = _IEPropertyGet($oIE, "locationURL")
$iURL2 = stringregexpreplace($iURL , "http://www.microsoft.com/en-us/download/details" , "http://www.microsoft.com/en-us/download/confirmation")
Else
msgbox (0, '' , "_IENAV Error: " & @ERROR)
Endif

_IENavigate($oIE , $iURL2 , 0)
If @ERROR = 0 Then
sleep (5000)
;~ _ArrayAdd ($regExLinks , $iURL2)
Else
msgbox (0, '' , "_IENAV Error: " & @ERROR)
Endif

$oLinks = _IELinkGetCollection($oIE)
If @Error = 0 Then

For $oLink In $oLinks
If StringInStr($oLink.innerText, "Start Download") Then
$DwnLink2 = ($oLink.href)
ExitLoop
EndIf
Next

If $DwnLink2 <> "a" Then
$aDwnLink = stringsplit ($DwnLink2 , "/")
InetGet($DwnLink2, @ScriptDir & "\KBs\" & $aDwnLink[$aDwnLink[0]] , 1 , 0)
Endif
EndIf

runwait ("cmd /c taskkill /IM iexplore.exe /F" , "" , @SW_HIDE)

Endif



_IEQuit ($oIE)



;~ _ArrayDisplay ($regExLinks)


EndFunc
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

You could always

$timer = TimerInit()
Do
   Sleep(100)
   $oLinks = _IELinkGetCollection($oIE)
Until (Not @error) Or (TimerDiff($timer) > 3000); or whatever time out.
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 1 month later...

I was receiving the same error and fixed it by upgrading to IE v10. The script that I was receiving the error with used to work, then it suddenly stopped. I tried other scripts and they all received the same error. Finally, I tried even just going to Google, but even that would not load. Upgrading to IE v10 seems to fix the problem, but I have no idea why. My guess is that the faster load times solves the timeout issues.

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

  • Recently Browsing   0 members

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