Sign in to follow this  
Followers 0
Deon

Can't submit a form in IE

2 posts in this topic

#1 ·  Posted (edited)

Trying to submit a form in IE, and I keep getting an error.. was working fine, and then all of a sudden stopped

 

 

#include<IE.au3>
$sUsername = "usernamegoeshere"
$sPassword = "passwordgoeshere"
$sUrl = "http://loginpageshere"
$oIE = _IECreate($sUrl, 0, 1, 0, 0)
Sleep(2000)
$oHWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($oHWND, "", @SW_MAXIMIZE)
$oForm = _IEFormGetCollection($oIE, 0)
$oUsername = _IEFormElementGetObjByName($oForm, 'username')
$oPassword = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)
 

Error is:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Deon\Documents\NameOfScript.au3"    
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (904) : ==> Variable must be of type "Object".:
Case $i_index > -1 And $i_index < $oTemp.forms.length
Case $i_index > -1 And $i_index < $oTemp^ ERROR
>Exit code: 1    Time: 2.730
Any assistance appreciated! Edited by Deon

Share this post


Link to post
Share on other sites



i would suggest checking the error/return values from each of the functions to see what is failing


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

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