Jump to content

macro login with _ie problem


Recommended Posts

hi guy how is possible login   in this site ??

https://it.shpock.com/my/signup/

i try to use  this  code  but  not work

#include <MsgBoxConstants.au3>
    #include <WinAPIFiles.au3>
    #include <File.au3>
    #include <IE.au3>
    #include <Array.au3>

Global $ISP_WEB = 0

_StartShpock()

Func _StartShpock()

        If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
            ProcessClose("iexplore.exe")
        EndIf

        Global $oIE = _IECreate("https://it.shpock.com/my/signup/", 0, 1, 1, 1) ; <--- 0011 invisible explorer  <--- 0111 visible explorer
        _IELoadWait($oIE)


        Local $oFirstCheckBox = _IEGetObjByClass($oIE, "password")
        If IsObj($oFirstCheckBox) Then
            $oFirstCheckBox.checked = True
        EndIf


EndFunc


Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)
    If Not IsObj($o_object) Then
        __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
    ;
    If Not __IEIsObjType($o_object, "browserdom") Then
        __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    ;
    Local $i_found = 0
    ;
    $o_tags = _IETagNameAllGetCollection($o_object)
    For $o_tag In $o_tags
        If String($o_tag.className) = $s_Class Then
            If ($i_found = $i_index) Then
                SetError($_IEStatus_Success)
                Return $o_tag
            Else
                $i_found += 1
            EndIf
        EndIf
    Next
    ;
    __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class)
    SetError($_IEStatus_NoMatch, 2)
    Return 0
EndFunc   ;==>_IEGetObjByClass

some one can help me ??

the html code

<input type="text" placeholder="Indirizzo email">
<input type="password" placeholder="Password" class="password">

thankz at  all :)

 

Link to comment
Share on other sites

thankz Bro for suppor  i  have  find a solution

Local $oBtns = $oIE.document.GetElementsByTagName("input")
    For $oBtn In $oBtns
        $classname = String($oBtn.classname())
        $placehold = String($oBtn.placeholder())
        ;ConsoleWrite($classname & @CRLF)
        If $classname = "password" Then
            _IEAction($oBtn, "click")
            _IEFormElementSetValue($oBtn, "lamail")
        EndIf
        If $placehold =  "Indirizzo email" Then
        _IEAction ($oBtn, "click")
        _IEFormElementSetValue($oBtn, "passeraword")
        EndIf
    Next

i put it   for  someone :D

thankz again at all

Edited by faustf
Link to comment
Share on other sites

This works as well ...

#include <IE.au3>

Local $oIE = _IECreate ("https://it.shpock.com/my/signup/")

Local $oForm = _IEFormGetCollection($oIE, 0)
Local $username = _IEFormElementGetCollection ($oForm, 1)
Local $password = _IEFormElementGetCollection ($oForm, 2)

_IEFormElementSetValue ($username, "myname")
_IEFormElementSetValue ($password, "myPassword")

_IEFormSubmit($oForm)

 

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