Get form name from iframe using AutoIt

I use AutoIt to automate filling out forms on a website.

But I had a problem getting the form name from the website. I look at the HTML source and find the form and its name, but I still get the IEStatus_noMatch error.

Is there an easier way to get the name of the form or how to find it?

I may run into the same problem for objects.

 $sUrl = "https://www.acgme.org/residentdatacollection/login.asp" $oIE = _IEAttach($sUrl, "url") If not isObj($oIE) Then $oIE = _IECreate() _IENavigate($oIE, $sUrl) EndIf ; Get pointers to the login form and username and password fields $o_form = _IEFormGetObjByName($oIE, "loginentry") $o_login = _IEFormElementGetObjByName($o_form, "USERID") $o_password = _IEFormElementGetObjByName($o_form, "PASSW") 
+6
source share
2 answers

I got this answer from the AutoIt forum here

There are two frames, and the form is in the second frame, so use $o_frame = _IEFrameGetCollection($oIE, 1) to get the second frame (index 1 is the second frame, index 0 will be the first).

Then get the form from the frame using: $o_form = _IEFormGetObjByName($o_frame, "loginentry")

So, the section of your code will look like this:

 ; get pointers to the login form and username and password fields $o_frame = _IEFrameGetCollection($oIE, 1) $o_form = _IEFormGetObjByName($o_frame, "loginentry") $o_login = _IEFormElementGetObjByName($o_form, "USERID") $o_password = _IEFormElementGetObjByName($o_form, "PASSW") 

USERID and PASSW are hidden fields, so you won’t see them filled. If the form is not submitted properly, use the names of the visible fields:

 $o_login = _IEFormElementGetObjByName($o_form, "posterior") $o_password = _IEFormElementGetObjByName($o_form, "fossa" 
+7
source

You are using the wrong function to get the form object ... _IEForm * Element * GetObjByName for sub-elements of the form. Instead, you should use the _IEFormGetObjByName function.

+1
source

Source: https://habr.com/ru/post/889558/


All Articles