Sign in to follow this  
Followers 0
boy233

Two submit - IEFormSubmit

2 posts in this topic

Hello, 

How do I select the submit?

Anybody know?!

<form method="post" action="register.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
....
....
<input type="submit" name="btnConfirm" value="Confirm" id="btnConfirm" disabled="disabled" class="aspNetDisabled Button" /> &nbsp;&nbsp;
....
....
<input type="submit" name="btnQuery" value="Query" id="btnQuery" disabled="disabled" class="aspNetDisabled Button" /> &nbsp;&nbsp;

</form>

 

Share this post


Link to post
Share on other sites



I found the solution! : D

Global $oIE = _IECreate("https://somewebsitehere", 1)


Local $username = _IEGetObjByName ($oIE, "username")
Local $password = _IEGetObjByName ($oIE, "password")
Local $button = _IEGetObjByName ($oIE, "login")
_IEFormElementSetValue ($username,"whatever username")
_IEFormElementSetValue ($password,"whatever password")

_IEAction ($button, "click")

 

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  
Followers 0

  • Similar Content

    • BobSherman
      By BobSherman
      I am attempting to enter the logon ID and password into the form below and submit it.
      But, I am experiencing an error in IE.au3 whether I use _IEAction to submit a click (which does submit the form) or _IEFormSubmit (which does not submit the form before it errors out).
      The form seems rather simple:
      <form method="post" action="logon_submit.php">
                             <input type="hidden" name="visit" value="sRhvMItOu1hNV_y9t4iB7xhns2UJ0pUIYmpJyy3CivjvGYv0ST1QHY40QP9H5UPTqonadminkin_65dvtXxSIXDPwyFFI6WPVQFmgFtba8vW3OH">
      <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
                          <tr>
                            <td valign=top><table width="100%" border="0" cellpadding="4" cellspacing="1">
                                <tr>
                                  <td align="Right"><b>Username: <span class="style1">*</span></b></td>
                                  <td width="80%"><input type="TEXT" name="user" style="width: 90%;">
                                  </td>
                                </tr>
                                <tr>
                                  <td align="Right"><b>Password: <span class="style1">*</span></b></td>
                                  <td><input type="password" name="pass" style="width: 90%;">
                                  </td>
                                </tr>
                                <tr>
                                  <td align="Right">&nbsp;</td>
                                  <td><input type="submit" name="Submit" value="Submit Form">
                                  </td>
                                </tr>
                                <tr>
                                  <td align="Right">&nbsp;</td>
                                  <td><a href="resetpw.php?visit=sRhvMItOu1hNV_y9t4iB7xhns2UJ0pUIYmpJyy3CivjvGYv0ST1QHY40QP9H5UPTqonadminkin_65dvtXxSIXDPwyFFI6WPVQFmgFtba8vW3OH" class=white>Forgot your password ?</a></td>
                                </tr>
                              </table>
                                <p>&nbsp;</p>
                            </td>
                          </tr>
                        </table>
                      </form>
       
      My function to perform the logon is:
       
      Func StartUp()
         _IELinkClickByText ( $oIE, "Log On" )
         Sleep(2000)
         Local $oForm = _IEFormGetCollection($oIE)
         Local $iNumberOfForms = @extended
         For $iForm = 0 To $iNumberOfForms - 1
           $oForm = _IEFormGetCollection($oIE, $iForm)
           Local $oQuery = _IEFormElementGetCollection($oForm)
           Local $iNumberOfFormElements = @extended
           For $iElement = 0 to $iNumberOfFormElements - 1
               Local $oFormElement = _IEFormElementGetCollection($oForm, $iElement )
               If $oFormElement.name = 'user' Then
                  _IEFormElementSetValue ( $oformElement, "xxxxx", 0)
               elseif $oFormElement.name = "pass" Then
                  _IEFormElementSetValue ( $oFormElement, "yyyyy", 0)
                  ; Sleep for 2 seconds.
                  Sleep(2000)
                  Local $oSubmit = _IEGetObjByName($oIE, "Submit")
                  _IEAction($oSubmit, "click")
                  Sleep(3000)
               EndIf
            Next
         Next
      EndFunc
       

      After the submission of the form completes and goes to the next page I'm getting the following error as a popup from AutoIt:
       

      Line 970 (File "D\Program Files (x86)\AutoIt3\Include\IE.au3"):
      Case $iIndex > -1 And $iIndex < $oObject.elements.length
      Case $iIndex > -1 And $iIndex < $oObject^ ERROR
      Error: The requested actions with this object has failed.

      It's hard to imagine that such a simple form is causing so many problems.
      Any help would be appreciated.
       
       
       
    • Servant
      By Servant
      How to click the tag <input type="submit" name="submit" id="submit" value="Publish this ad"> on this kind of form?
      <form name="publish_form" id="publish_form" method="post" action="http://www.example.com/jobs/publish/xxxxx/">     <fieldset>         <div class="right">             <div class="suggestion">If you changed your mind, you may <a href="http://www.example.com/jobs/deactivate/xxxxx/" title="cancel posting this ad">cancel posting this ad</a></div>         </div>         <input type="submit" name="submit" id="submit" value="Publish this ad">         &nbsp;or&nbsp;         <a href="http://www.example.com/jobs/post/xxxxx/" title="Edit it">Edit it</a>     </fieldset> </form> I already tried this code:
      #include <IE.au3> Local $oForm = _IEFormGetObjByName($oIE, "publish_form") Sleep(2000) _IEFormSubmit($oForm) But it caused a problem: --> IE.au3 T3.0-1 Error from function _IEFormSubmit, $_IEStatus_COMError (-2147352573)
      Is there any other way to submit that kind of form?
    • Loken
      By Loken
      Hi Autoit Forum ,
      I want to learn how to click a submit  who have to know class and value.
      <input class="classb" type="submit" name="R_YTRD" value="Sign In"/>  
      Thanks ..
    • remin
      By remin
      I created a search GUI with an InputBox and a Button to empty the input box.
      I read the inputbox using GuiCtrlRead and empty the input box using GUICtrlSetData.
      When I click a search button or click the "empty inputbox" button, everything works fine.
      However after having done the 1st search and I click again on the search button
      or whatever other button the input box field is not updated 
      GUICtrlRead($RWSearch)  --> gives a value '0'
      What did I wrong?
      Same thing when I empty the input box.
      The 1st time it works well.
      When I empty the inputbox after having done a search it doesn't
      work anymore. Nothing happens.
      My search GUI is always on TOP so I don't reuse the hotkey between searches.
      (The GUI is not deleted after a search), 
       
      My code:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> #include <GuiButton.au3> #include <Constants.au3> HotKeySet("^4", "searchmenu") While 1     Sleep(10000) WEnd Func searchmenu() global $url Send("^c") $InEditBox = ClipGet() ;========GUI=============  $Form5 =         GUICreate("Search Menu", 345, 410, 100, 100)  $RWSearch =      GUICtrlCreateInput($InEditBox,                      16,  10, 270, 25)  $clipc =         GUICtrlCreateButton("x",                           300,  10,  15, 20)  $textGoogle  =   GUICtrlCreateLabel("Google:",                       20,  50, 100, 20)  $bsearch =       GUICtrlCreateButton("Search",                      110,  50,  60, 20)  $bimages =       GUICtrlCreateButton("Images",                      175,  50,  60, 20) GUISetState(@SW_SHOW) ;========GUI============= While 1 $nMsg = GUIGetMsg() Switch $nMsg    Case $GUI_EVENT_CLOSE         GuiDelete($Form5)         ExitLoop       Case $clipc ; empty inputbox            GUICtrlSetData($RWSearch, "")       Case $bsearch ; search text in google            $RWSearch = GUICtrlRead($RWSearch)            $RWSearch = StringRegExpReplace($RWSearch, "(\s+)", "+")            $url = "https://www.google.com/search?q=" & $RWSearch            SearchMenuExec()       Case $bimages ; search images in google            $RWSearch = GUICtrlRead($RWSearch)            $RWSearch = StringRegExpReplace($RWSearch, "(\s+)", "+")            $url = "http://images.google.com/images?hl=en&q=" & $RWSearch            SearchMenuExec() EndSwitch  WEnd EndFunc Func SearchMenuExec()   ClipPut($url)   ShellExecute($url)  EndFunc