Jump to content

$oIE stuck on single instance


 Share

Recommended Posts

Here's a quick function I made just for this post.

Func onkyoSignIn ()
$oIE = _IECreate ("http://sales.onkyousa.com/",0,1,0)
_IELoadWait($oIE)
$username = _IEGetObjByName ($oIE, "UserName")
$password = _IEGetObjByName ($oIE, "Password")
$oForm = _IEFormGetCollection($oIE, 0)
_IEFormElementSetValue ($username, "blablah",0)
_IEFormElementSetValue ($password, "blahblah",0)
_IEFormSubmit($oForm)

sleep(5000)

Local $oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
    If $oElement.id Then MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $oElement.id & @CRLF & "innerText: " & $oElement.innerText
Next
EndFunc

Problem:  When $oIE is attached to http://sales.onkyo.com it seems to be stuck on that single instance. For example, once the script logs in to the redirected URL $oIE is still only able to read information from the initial login page. 

What I have tried: 

_IEAttach ("GMS")

_IEAction($oIE, "refresh")

Here's something interesting: Inserting Example 5 from _IEAttach ()  right after the sleep(5000) , $oIE did infact work for about a hour. Then after finishing a cup of coffee it was not working again. Maybe since I had so many instances open it attached to another one somehow. I don't know for sure since it stop working again once I thought I correct the problem.

Local $aIE[1]
$aIE[0] = 0

Local $i = 1, $oIE
While 1
    $oIE = _IEAttach("", "instance", $i)
    If @error = $_IEStatus_NoMatch Then ExitLoop
    ReDim $aIE[$i + 1]
    $aIE[$i] = $oIE
    $aIE[0] = $i
    $i += 1
WEnd

Any help would be great. I have been at this for about a week now.

 

Regards,

Link to comment
Share on other sites

You don't need to re-attach.  You might need to wait on load, or loop for objects on the next page if they take a while to display.  Also, sometimes the browser will be inaccessible to com, so you need to add in an error handler, and do loops to wait for things.

_IEErrorHandlerRegister

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...