Jump to content

au3 script for IE:- how to identify the form object - (Moved)


Deshanur
 Share

Recommended Posts

Am trying to automate injecting credential on the login form for all kind of Web application for IE. I know how to identify the form name by viewing the source code and using the method - _IEFormGetObjByName($ie, $form_Name).

I would like to know how to identify or get the form object for the web app where there is no form name tag for example below, for the is I have used - _IEFormGetCollection($ie, 0) to get the form object.

My Question is does it work for all kind of application "_IEFormGetCollection($ie, 0)" how to identify Index value? is it always 0? is there any better solution?

The final solution am looking for is find out form object, get the username, password field and inject credential and submit the form.

How to find out index value? for the forms which does not have form name field.

$login_form = _IEFormGetCollection($ie, 0)
$email_field = _IEFormElementGetObjByName($login_form, $form_UserName)
$pass_field = _IEFormElementGetObjByName($login_form, $form_password)
$login_button = _IEFormElementGetObjByName($login_form, $form_submitbutton)
_IEFormElementSetValue($email_field, $CmdLine[2])
_IEFormElementSetValue($pass_field, $CmdLine[3])
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]","{Enter}")

OR
This works fine if the form has form name.
$login_form = _IEFormGetObjByName($ie, $form_Name)
$email_field = _IEFormElementGetObjByName($login_form, $form_UserName)
$pass_field = _IEFormElementGetObjByName($login_form, $form_password)
$login_button = _IEFormElementGetObjByName($login_form, $form_submitbutton)
_IEFormElementSetValue($email_field, $CmdLine[2])
_IEFormElementSetValue($pass_field, $CmdLine[3])
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]","{Enter}")
Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×
×
  • Create New...