Jump to content
Sign in to follow this  
faustf

macro login with _ie problem

Recommended Posts

faustf

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 :)

 

Share this post


Link to post
Share on other sites
Danp2
26 minutes ago, faustf said:

i try to use  this  code  but  not work

 

"Doesn't work" isn't very descriptive. Post the output from the Scite window. Tell us which line it failed on. Give us something to go on... ^_^

Also, why are you treating the password field as a checkbox?

Share this post


Link to post
Share on other sites
faustf

scite   give me is all ok

because i dont  have idea  how  to write inside of  it , because not  have  id  or  name or other marker

 how is possible to write inside of  it ???

thankz

 

Share this post


Link to post
Share on other sites
faustf

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

Share this post


Link to post
Share on other sites
Danp2

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)

 

  • Like 1

Share this post


Link to post
Share on other sites
faustf

:)  thankz so much i test it sure i like :)

 

Share this post


Link to post
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
Sign in to follow this  

×