Sign in to follow this  
Followers 0
cypher175

Other Ways To Submit a Form Besides _IEFormSubmit($Form)..?

10 posts in this topic

Are there any other ways to submit a form if _IEFormSubmit($Form) doesn't work..??

is there anyway to find the "Input type=submit" in the $Form object reference and then use that to submit the form..??

Something like

$GetFormInputs = _IETagNameGetCollection($Form, 'input')
For $Input in $GetFormInputs
If $Input.type = "submit" Then (Somehow Submit $Form..??)
Next

Share this post


Link to post
Share on other sites



You can navigate to the page like:

http://www.somesite.com/search?s=somethingtosearch&f=somethingtofilter

Or if the form contain another input element to submit it's content like a button then you can reference this button and use _IEAction($oButton, 'click').

Share this post


Link to post
Share on other sites

Is there anyway to get an object reference to the Submit button by doing

If $Input.type = "submit" Then $Submit = $Input.name
_IEAction($Submit, 'click')

or somthing along the lines of that by searching for the $Input.type = "submit" in the form..??

Share this post


Link to post
Share on other sites

Yup, you don't need the $Submit = $Input.name because it's just a string representation of the object name and not the object itself.

For $oObject In $oObjects
   If $oObject.Type = "submit" Then
         _IEAction($oObject, 'click')
         ExitLoop
   EndIf
Next

Share this post


Link to post
Share on other sites

so do i need to get an object collection for the form 1st or what..??

Share this post


Link to post
Share on other sites

Yes. It's using _IEFormGetObjByName and then using _IETagNameGetCollection($oForm, 'input') and then start enumerating the inputs.

Share this post


Link to post
Share on other sites

Sumthing like this or what..??

For some reason the Submission of the Form on this page http://www.charlietheunicorn.info is being a pain in the biatch...

think you can help me figure out why my code ain worken to submit that biatch..

#NoTrayIcon
#include <IE.au3>
#include <Misc.au3>
_Singleton(@ScriptName)

$IE = _IECreate ("http://www.charlietheunicorn.info",0,1,1,0)

$FindForm = _IETagNameGetCollection($IE, 'form')
For $Form In $FindForm
    
    If StringInStr($Form.Action, 'index.php') Then 
        $GetFormInputs = _IETagNameGetCollection($Form, 'input')
        For $Input in $GetFormInputs
            If $Input.type = "text" Then $Input.value = "http://www.url.com"
            If $Input.Type = "submit" Then _IEAction($Input, 'click')
            ExitLoop 2
        Next
    EndIf
next

Share this post


Link to post
Share on other sites

thanx, but im trying to submit the form without using either :

Dim $oQuery = _IEGetObjByName($oIE, 'q')

Dim $oSubmit = _IEGetObjByName($oIE, 'submit')

im trying to do it on a blind bases by searching the form for certain things like "If $Input.type = "text" Then $Input.value = "http://www.url.com"

and

If $Input.Type = "submit" Then _IEAction($Input, 'click')

Share this post


Link to post
Share on other sites

There you go, I still don't see the point:

#include <IE.au3>

Dim $sURL = 'http://www.autoitscript.com'
Dim $oIE = _IECreate('http://www.charlietheunicorn.info/')
Dim $oForms = _IEFormGetCollection($oIE)
Dim $oInputs

For $oForm In $oForms
    If StringInStr($oForm.Action, 'index.php') Then
        $oInputs = _IETagNameGetCollection($oForm, 'input')
    
        For $oInput In $oInputs
            $oInput.ScrollIntoView()
            Switch $oInput.Type
                Case 'text'
                    _IEFormElementSetValue($oInput, $sURL)
                Case 'submit'
                    _IEAction($oInput, 'click')
                    ExitLoop(2)
            EndSwitch
        Next
    EndIf
    Sleep(50)
Next

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