Jump to content

IEAction not click button submit ?


pocolo
 Share

Recommended Posts

<form action="http://www.wupload.com/account/login" id="loginWidgetForm" method="post">
                <div class="content">
                    <div class="fields">
                        <div class="field required tText fEmail">
                            <label for="loginWidgetEmail">Username</label>
                            <div class="elements">
                                <input type="text" name="email" id="loginWidgetEmail" />
                                <input type="hidden" name="redirect" value="/account/login" />
                            </div>
                        </div>
                      <div class="field required tPassword fPassword">
                          <label for="loginWidgetPassword">Password</label>
                             <div class="elements">
                                <input type="password" name="password" id="loginWidgetPassword" />
                             </div>
                            <div class="forgotPass">
                                <a href="http://www.wupload.com/account/forgot-password">Forgot Password?</a>
                        </div>
                        </div>
                        <div class="field tMultiCheckbox fLoginOptions">
                            <div class="elements">
                                <label for="loginWidgetRememberMe"><input type="checkbox" name="rememberMe" id="loginWidgetRememberMe" value="1" /> Remember me</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="action">
                    <button type="submit" class="smallButton"><span>Login</span></button>
                </div>
            </form>

$email =""
$pass= ""
 
$oIE = _IECreate("http://www.wupload.com/account/login",0,1,0)
  If _IELoadWait($oIE) = 0 Then
   Return
  EndIf
  $oLoginForm = _IEFormGetCollection($oIE)
  For $i = 0 To @extended - 1
   $oLoginForm = _IEFormGetCollection($oIE, $i)
   If StringRight($oLoginForm.action, StringLen("http://www.wupload.com/account/login")) = "http://www.wupload.com/account/login" Then
    ExitLoop
   Else
    $oLoginForm = -1
   EndIf
  Next
  If $oLoginForm = -1 Then Return
  $oUsernameInput = _IEFormElementGetObjByName($oLoginForm, "email")
  $oPasswordInput = _IEFormElementGetObjByName($oLoginForm, "password")
  _IEFormElementSetValue($oUsernameInput,$email)
  _IEFormElementSetValue($oPasswordInput, $pass)
_IEFormSubmit ($oIE) ; dont' work
  $oButtons = _IETagNameGetCollection ($oIE, "button")
  For $oButton In $oButtons  
   If $oButton.type = "submit" And $oButton.class = "smallButton" Then
     _IEAction ($oButton, 'click')  
   EndIf
  Next

Why _IEAction not click button ?

Link to comment
Share on other sites

  • Moderators

#include <IE.au3>

Global $gs_Username = "MyUsername"
Global $gs_Password = "MyPassword"

Global $go_IE = _IEAttach("Wupload, ultimate file hosting")
If Not IsObj($go_IE) Then Exit 1

Global $go_Username = _IEGetObjById($go_IE, "email")
If Not IsObj($go_Username) Then Exit 2

Global $go_Password = _IEGetObjById($go_IE, "password")
If Not IsObj($go_Password) Then Exit 3

Global $go_Submit = _IEGetObjById($go_IE, "controls-submit")
If Not IsObj($go_Submit) Then Exit 4

$go_Username.Value = $gs_Username
$go_Password.Value = $gs_Password


_IEAction($go_Submit, "click")
If @error Then Exit 5

Exit 0 ; success

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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