Jump to content

[SOLVED] Help with Interaction with IE


Recommended Posts

Hello.

I'd like to ask some help with IE interaction.

Basically, My script opens a webpage, then checks for an expected form named login and passwd:

; Collects info from the opened page
$oForms = _IEFormGetCollection($oIE)
Local $iNumForms = @extended
If $iNumForms = 1 Then
    $oForm = _IEFormGetCollection($oIE, 0)
    $oObjs = _IEFormElementGetCollection($oForm)
    Local $iNumObj = @extended
Else
    ; insert error treatment here
    Exit
EndIf



If $iNumObj = 3 Then ; Check if there are 3 objects in the page (login / pass / submit)
    Sleep(1000) ; Emulating a user typing infos
    $oObj = _IEFormElementGetObjByName($oForm, "login")
    _IEFormElementSetValue($oObj, "barackobama")  
    Sleep(1000) ; Emulating the user
    $oObj = _IEFormElementGetObjByName($oForm, "passwd")
    _IEFormElementSetValue($oObj, "UncleSam2015") 
    Sleep(1000) ; Emulating the user
    _IEFormSubmit($oForm)
Else
    ; insert error treatment here
    Exit
EndIf

It goes to a loading screen, it usually takes 2-10 seconds. Then, it goes to a main screen dashboard.

The ElementGetObjByName gets this info from the page:

<input class="CTXMSAM_ContentFont" type="Password" title="Enter password" name="passwd" size="30" maxlength="127" style="width:100%;">

I need to verify if it really logs in (kinda worked around this), and how long it takes to load the main screen (that classic loading spinning ball).

I was trying to do it by counting the forms or objects, but it's not possible, since there is no forms on the main screen, and both the loading screen and the main screen has 1 object. The main screen though, has an object already identifier (searchbox), but it also doesn't have a name. The code of the searchbox is as below:

<input class="searchbox-textbox lighttext" type="text" autocomplete="off" title="Search">

Is there any way for me to track/identify this page with or without IE.au3?

Thanks.

 

Edited by DavidLago
Link to comment
Share on other sites

Well,

Fixed it with this: 

 

$WhileT2 = False
$timeLogIn = ""

While $WhileT2 = False
    Local $sInfo = ""
    Sleep(500)
    Local $oImg = _IEImgGetCollection($oIE, 1)
    Local $sInfo = $oImg.src
    If $sInfo <> ".../uiareas/Store/media/DownArrow.png" Then
        $timeLogIn = $timeLogIn + 0.5 ; use timeinit and diff later
        if $timeLogIn > 10 Then MsgBox(16, "Error", $timeLogIn)
    Else
        $WhileT2 = True
        MsgBox(64, $timeLogIn, $sInfo) ; test
    EndIf
WEnd

 

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...